Skip to content

Commit 1f15abf

Browse files
committed
fixes
1 parent 87448b0 commit 1f15abf

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

agent/lib_aws_sdk_php.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ void nr_lib_aws_sdk_php_lambda_handle(nr_segment_t* auto_segment,
340340

341341
/* reconstruct the ARN */
342342
nr_aws_lambda_invoke(NR_EXECUTE_ORIG_ARGS, &cloud_attrs);
343-
if (!cloud_attrs.cloud_resource_id) {
343+
if (NULL == cloud_attrs.cloud_resource_id) {
344344
/* we do not want to instrument if we cannot reconstruct the ARN */
345345
return;
346346
}
@@ -352,6 +352,7 @@ void nr_lib_aws_sdk_php_lambda_handle(nr_segment_t* auto_segment,
352352
*/
353353
external_segment = nr_segment_start(NRPRG(txn), NULL, NULL);
354354
if (NULL == external_segment) {
355+
nr_free(cloud_attrs.cloud_resource_id);
355356
return;
356357
}
357358
/* re-use start time from auto_segment started in func_begin */
@@ -379,6 +380,7 @@ void nr_lib_aws_sdk_php_lambda_handle(nr_segment_t* auto_segment,
379380
}
380381
}
381382
nr_segment_external_end(&auto_segment, &external_params);
383+
nr_free(cloud_attrs.cloud_resource_id);
382384
}
383385

384386
/* This stores the compiled regex to parse AWS ARNs. The compilation happens when

agent/tests/test_lib_aws_sdk_php.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ NR_PHP_WRAPPER(aws_lambda_invoke_wrapper) {
8181
cloud_attrs.cloud_resource_id);
8282
}
8383
NR_PHP_WRAPPER_CALL;
84+
nr_free(cloud_attrs.cloud_resource_id);
8485
}
8586
NR_PHP_WRAPPER_END
8687

0 commit comments

Comments
 (0)