From: Dmitry Stogov Date: Tue, 19 Feb 2008 16:39:02 +0000 (+0000) Subject: Fixed memory leaks X-Git-Tag: php-5.2.6RC1~43 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=12e8e280c79a26a2beeebc4d753ff70633855003;p=php Fixed memory leaks --- diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index df7f22a844..2ddb0cbedd 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -1218,6 +1218,7 @@ ZEND_FUNCTION(set_error_handler) had_orig_error_handler = 1; *return_value = *EG(user_error_handler); zval_copy_ctor(return_value); + INIT_PZVAL(return_value); zend_stack_push(&EG(user_error_handlers_error_reporting), &EG(user_error_handler_error_reporting), sizeof(EG(user_error_handler_error_reporting))); zend_ptr_stack_push(&EG(user_error_handlers), EG(user_error_handler)); } @@ -1232,6 +1233,7 @@ ZEND_FUNCTION(set_error_handler) EG(user_error_handler_error_reporting) = (int)error_type; *EG(user_error_handler) = *error_handler; zval_copy_ctor(EG(user_error_handler)); + INIT_PZVAL(EG(user_error_handler)); if (!had_orig_error_handler) { RETURN_NULL(); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 6d7402f78b..607c0d3f13 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -181,6 +181,13 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS) ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_ZVAL(*(EX_T(opline->result.u.var).var.ptr)); +if (strcmp(EX(function_state).function->common.function_name, "set_error_handler") == 0) { +static n = 0; +++n; +if (n>=542) { +fprintf(stderr, "%3d 0x%08X %s\n", n, EX_T(opline->result.u.var).var.ptr, EX(function_state).function->common.function_name); +} +} if (EX(function_state).function->common.arg_info) { zend_uint i=0;