@@ -136,7 +136,6 @@ static void nr_laravel_queue_set_cat_txn(zval* job TSRMLS_DC) {
136136 }
137137
138138 if (headers .dt_payload || headers .traceparent ) {
139-
140139 nr_hashmap_t * header_map = nr_header_create_distributed_trace_map (
141140 headers .dt_payload , headers .traceparent , headers .tracestate );
142141
@@ -225,6 +224,11 @@ static char* nr_laravel_queue_job_txn_name(zval* job TSRMLS_DC) {
225224
226225 name = nr_formatf ("%s (%s:%s)" , resolve_name , connection_name , queue_name );
227226
227+ nr_free (connection_name );
228+ nr_free (resolve_name );
229+ nr_free (queue_name );
230+
231+ /* Caller is responsible for freeing name. */
228232 return name ;
229233}
230234
@@ -252,6 +256,7 @@ NR_PHP_WRAPPER(nr_laravel_queue_syncqueue_raiseBeforeJobEvent_before) {
252256
253257 job = nr_php_arg_get (1 , NR_EXECUTE_ORIG_ARGS );
254258
259+ /* txn_name needs to be freed by the caller. */
255260 txn_name = nr_laravel_queue_job_txn_name (job );
256261
257262 /*
@@ -271,6 +276,7 @@ NR_PHP_WRAPPER(nr_laravel_queue_syncqueue_raiseBeforeJobEvent_before) {
271276 NR_OK_TO_OVERWRITE );
272277 }
273278 nr_php_arg_release (& job );
279+ nr_free (txn_name );
274280 NR_PHP_WRAPPER_CALL ;
275281}
276282NR_PHP_WRAPPER_END
@@ -317,6 +323,7 @@ NR_PHP_WRAPPER(nr_laravel_queue_worker_raiseBeforeJobEvent_after) {
317323 nr_txn_set_path ("Laravel" , NRPRG (txn ), txn_name , NR_PATH_TYPE_CUSTOM ,
318324 NR_OK_TO_OVERWRITE );
319325 }
326+ nr_free (txn_name );
320327 nr_php_arg_release (& job );
321328 NR_PHP_WRAPPER_CALL ;
322329}
@@ -574,7 +581,7 @@ NR_PHP_WRAPPER(nr_laravel_queue_worker_process) {
574581 * as the first parameter.
575582 */
576583 char * connection_name = NULL ;
577- char * job_name ;
584+ char * job_name = NULL ;
578585 char * txn_name = NULL ;
579586
580587 connection = nr_php_arg_get (1 , NR_EXECUTE_ORIG_ARGS TSRMLS_CC );
0 commit comments