Skip to content

Commit c2933c2

Browse files
committed
Fixed invalid pointer usage (tests/output/ob_start_callbacks.phpt)
1 parent 7c623c0 commit c2933c2

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

main/output.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,7 @@ PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler,
495495
user = ecalloc(1, sizeof(php_output_handler_user_func_t));
496496
if (SUCCESS == zend_fcall_info_init(output_handler, 0, &user->fci, &user->fcc, &handler_name, &error TSRMLS_CC)) {
497497
handler = php_output_handler_init(handler_name->val, handler_name->len, chunk_size, (flags & ~0xf) | PHP_OUTPUT_HANDLER_USER TSRMLS_CC);
498-
if (Z_REFCOUNTED_P(output_handler)) Z_ADDREF_P(output_handler);
499-
user->zoh = output_handler;
498+
ZVAL_COPY(&user->zoh, output_handler);
500499
handler->func.user = user;
501500
} else {
502501
efree(user);
@@ -709,7 +708,7 @@ PHPAPI void php_output_handler_dtor(php_output_handler *handler TSRMLS_DC)
709708
//??? STR_FREE(handler->buffer.data);
710709
if (handler->buffer.data) efree(handler->buffer.data);
711710
if (handler->flags & PHP_OUTPUT_HANDLER_USER) {
712-
zval_ptr_dtor(handler->func.user->zoh);
711+
zval_ptr_dtor(&handler->func.user->zoh);
713712
efree(handler->func.user);
714713
}
715714
if (handler->dtor && handler->opaq) {

main/php_output.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ typedef struct _php_output_handler *(*php_output_handler_alias_ctor_t)(const cha
123123
typedef struct _php_output_handler_user_func_t {
124124
zend_fcall_info fci;
125125
zend_fcall_info_cache fcc;
126-
zval *zoh;
126+
zval zoh;
127127
} php_output_handler_user_func_t;
128128

129129
typedef struct _php_output_handler {

0 commit comments

Comments
 (0)