From: Antony Dovgal Date: Wed, 20 Dec 2006 23:19:44 +0000 (+0000) Subject: fix possible leak on failure in get_defined_functions() X-Git-Tag: RELEASE_1_0_0RC1~596 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=120275b00e0d9e4bf36b4db080485be0ef46880b;p=php fix possible leak on failure in get_defined_functions() --- diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index a5c8ca1c83..97e9a63685 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -1500,11 +1500,16 @@ ZEND_FUNCTION(get_defined_functions) zend_hash_apply_with_arguments(EG(function_table), (apply_func_args_t) copy_function_name, 2, internal, user); if (zend_ascii_hash_add(Z_ARRVAL_P(return_value), "internal", sizeof("internal"), (void **)&internal, sizeof(zval *), NULL) == FAILURE) { + zval_ptr_dtor(&internal); + zval_ptr_dtor(&user); + zval_dtor(return_value); zend_error(E_WARNING, "Cannot add internal functions to return value from get_defined_functions()"); RETURN_FALSE; } if (zend_ascii_hash_add(Z_ARRVAL_P(return_value), "user", sizeof("user"), (void **)&user, sizeof(zval *), NULL) == FAILURE) { + zval_ptr_dtor(&user); + zval_dtor(return_value); zend_error(E_WARNING, "Cannot add user functions to return value from get_defined_functions()"); RETURN_FALSE; }