@@ -375,12 +375,17 @@ void dd_request_abort_redirect(void)
375375 ? ZSTR_VAL (_block_parameters -> security_response_id )
376376 : "" );
377377 } else {
378+ zend_string * security_response_id = NULL ;
379+ if (_block_parameters -> security_response_id ) {
380+ security_response_id =
381+ zend_string_dup (_block_parameters -> security_response_id , 0 );
382+ }
378383 _emit_error ("Datadog blocked the request and attempted a redirection "
379384 "to %s. No action required. Security Response ID: %s" ,
380385 ZSTR_VAL (_block_parameters -> redirection_location ),
381- _block_parameters -> security_response_id
382- ? ZSTR_VAL ( _block_parameters -> security_response_id )
383- : "" ) ;
386+ security_response_id ? ZSTR_VAL ( security_response_id ) : "" );
387+ zend_string_release ( security_response_id );
388+ security_response_id = NULL ;
384389 }
385390}
386391
@@ -462,11 +467,16 @@ void _request_abort_static_page(int response_code, int type)
462467 ? ZSTR_VAL (_block_parameters -> security_response_id )
463468 : "" );
464469 } else {
470+ zend_string * security_response_id = NULL ;
471+ if (_block_parameters -> security_response_id ) {
472+ security_response_id =
473+ zend_string_dup (_block_parameters -> security_response_id , 0 );
474+ }
465475 _emit_error ("Datadog blocked the request and presented a static error "
466476 "page. No action required. Security Response ID: %s" ,
467- _block_parameters -> security_response_id
468- ? ZSTR_VAL ( _block_parameters -> security_response_id )
469- : "" ) ;
477+ security_response_id ? ZSTR_VAL ( security_response_id ) : "" );
478+ zend_string_release ( security_response_id );
479+ security_response_id = NULL ;
470480 }
471481}
472482
@@ -552,13 +562,18 @@ static bool _abort_prelude(void)
552562 ? ZSTR_VAL (_block_parameters -> security_response_id )
553563 : "" );
554564 } else {
565+ zend_string * security_response_id = NULL ;
566+ if (_block_parameters -> security_response_id ) {
567+ security_response_id =
568+ zend_string_dup (_block_parameters -> security_response_id , 0 );
569+ }
555570 _emit_error (
556571 "Datadog blocked the request, but the response has already "
557572 "been partially committed. No action required. Security "
558573 "Response ID: %s" ,
559- _block_parameters -> security_response_id
560- ? ZSTR_VAL ( _block_parameters -> security_response_id )
561- : "" ) ;
574+ security_response_id ? ZSTR_VAL ( security_response_id ) : "" );
575+ zend_string_release ( security_response_id );
576+ security_response_id = NULL ;
562577 }
563578 return false;
564579 }
0 commit comments