@@ -281,11 +281,6 @@ static inline void nr_php_amqplib_insert_dt_headers(zval* amqp_msg) {
281
281
return ;
282
282
}
283
283
284
- /*
285
- * Get application+_headers string in zval form for use with nr_php_call
286
- */
287
- ZVAL_STRING (& application_headers_zpd , "application_headers" );
288
-
289
284
/*
290
285
* The application_headers are stored in an encoded PhpAmqpLib\Wire\AMQPTable
291
286
* object
@@ -308,18 +303,32 @@ static inline void nr_php_amqplib_insert_dt_headers(zval* amqp_msg) {
308
303
"})();" ,
309
304
& amqp_table_retval_zpd , "newrelic.amqplib.add_empty_headers" );
310
305
311
- if (FAILURE == retval
312
- || !nr_php_is_zval_valid_object (& amqp_table_retval_zpd )) {
306
+ if (FAILURE == retval ) {
307
+ nrl_verbosedebug (NRL_INSTRUMENT ,
308
+ "No application headers in AMQPTable, but couldn't "
309
+ "create one. Exit." );
310
+ goto end ;
311
+ }
312
+ if (!nr_php_is_zval_valid_object (& amqp_table_retval_zpd )) {
313
313
nrl_verbosedebug (NRL_INSTRUMENT ,
314
314
"No application headers in AMQPTable, but couldn't "
315
315
"create one. Exit." );
316
+ zval_ptr_dtor (& amqp_table_retval_zpd );
316
317
goto end ;
317
318
}
319
+ /*
320
+ * Get application+_headers string in zval form for use with nr_php_call
321
+ */
322
+ ZVAL_STRING (& application_headers_zpd , "application_headers" );
318
323
/*
319
324
* Set the valid AMQPTable on the AMQPMessage.
320
325
*/
321
326
retval_set_property_zvf = nr_php_call (
322
327
amqp_msg , "set" , & application_headers_zpd , & amqp_table_retval_zpd );
328
+
329
+ zval_ptr_dtor (& application_headers_zpd );
330
+ zval_ptr_dtor (& amqp_table_retval_zpd );
331
+
323
332
if (NULL == retval_set_property_zvf ) {
324
333
nrl_verbosedebug (NRL_INSTRUMENT ,
325
334
"AMQPMessage had no application_headers AMQPTable, but "
@@ -396,8 +405,6 @@ static inline void nr_php_amqplib_insert_dt_headers(zval* amqp_msg) {
396
405
end :
397
406
nr_php_zval_free (& dt_headers_zvf );
398
407
nr_php_zval_free (& retval_set_property_zvf );
399
- zval_ptr_dtor (& application_headers_zpd );
400
- zval_ptr_dtor (& amqp_table_retval_zpd );
401
408
}
402
409
403
410
/*
0 commit comments