]> granicus.if.org Git - php/commitdiff
Fixed memory leaks
authorDmitry Stogov <dmitry@php.net>
Tue, 19 Feb 2008 16:39:02 +0000 (16:39 +0000)
committerDmitry Stogov <dmitry@php.net>
Tue, 19 Feb 2008 16:39:02 +0000 (16:39 +0000)
Zend/zend_builtin_functions.c
Zend/zend_vm_execute.h

index df7f22a84433df95c21f4d061ceca5cdc043b593..2ddb0cbedd542cdb82e3e9d8d53d24f0d65bee68 100644 (file)
@@ -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();
index 6d7402f78b108e1834572bd697f3ccd9454a0585..607c0d3f13c98e1e737a4a0d741df7a0bf52ef3a 100644 (file)
@@ -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;