Skip to content

Commit

Permalink
fix(agent): NULL check before accessing segment wraprec (#923)
Browse files Browse the repository at this point in the history
  • Loading branch information
zsistla authored Jun 21, 2024
1 parent 46d9eb5 commit 5154931
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion agent/fw_drupal.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,9 @@ NR_PHP_WRAPPER(nr_drupal_http_request_before) {
* fcall_end is able to properly dispatch to the after wrapper, as
* this new segment is now at the top of the segment stack.
*/
NRPRG(drupal_http_request_segment)->wraprec = auto_segment->wraprec;
if (NULL != NRPRG(drupal_http_request_segment)) {
NRPRG(drupal_http_request_segment)->wraprec = auto_segment->wraprec;
}
}
}
NR_PHP_WRAPPER_END
Expand Down
5 changes: 3 additions & 2 deletions agent/lib_predis.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,9 @@ NR_PHP_WRAPPER(nr_predis_webdisconnection_executeCommand_before) {

nr_segment_t* segment = NULL;
segment = nr_segment_start(NRPRG(txn), NULL, NULL);
segment->wraprec = auto_segment->wraprec;
if (NULL != segment) {
segment->wraprec = auto_segment->wraprec;
}
}
NR_PHP_WRAPPER_END

Expand Down Expand Up @@ -894,5 +896,4 @@ void nr_predis_enable(TSRMLS_D) {
NR_PSTR("Predis\\Connection\\WebdisConnection::executeCommand"),
nr_predis_webdisconnection_executeCommand TSRMLS_CC);
#endif /* OAPI */

}

0 comments on commit 5154931

Please sign in to comment.