diff options
author | Antony Dovgal <tony2001@php.net> | 2008-02-02 22:29:41 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2008-02-02 22:29:41 +0000 |
commit | 4904889568e6024d24ea52b07b8ec86dea5d1e6d (patch) | |
tree | 7f1c875bacd1b072bf0341463941ec46379d336d /Zend/zend_API.c | |
parent | cd2953db579c16760a577876e1a220fe38fd31a6 (diff) | |
download | php-git-4904889568e6024d24ea52b07b8ec86dea5d1e6d.tar.gz |
MFH: fix leak appearing when calling non-static protected or private methods as static
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r-- | Zend/zend_API.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index fe921a0ddc..05ab18d5f5 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2314,6 +2314,10 @@ static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, ze zend_function *fptr; HashTable *ftable; + if (error) { + *error = NULL; + } + *ce_ptr = NULL; *fptr_ptr = NULL; @@ -2431,12 +2435,22 @@ static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, ze if (retval && (check_flags & IS_CALLABLE_CHECK_NO_ACCESS) == 0) { if (fptr->op_array.fn_flags & ZEND_ACC_PRIVATE) { if (!zend_check_private(fptr, *zobj_ptr_ptr ? Z_OBJCE_PP(*zobj_ptr_ptr) : EG(scope), lmname, mlen TSRMLS_CC)) { - if (error) zend_spprintf(error, 0, "cannot access private method %s::%s()", (*ce_ptr)->name, fptr->common.function_name); + if (error) { + if (*error) { + efree(*error); + } + zend_spprintf(error, 0, "cannot access private method %s::%s()", (*ce_ptr)->name, fptr->common.function_name); + } retval = 0; } } else if ((fptr->common.fn_flags & ZEND_ACC_PROTECTED)) { if (!zend_check_protected(fptr->common.scope, EG(scope))) { - if (error) zend_spprintf(error, 0, "cannot access protected method %s::%s()", (*ce_ptr)->name, fptr->common.function_name); + if (error) { + if (*error) { + efree(*error); + } + zend_spprintf(error, 0, "cannot access protected method %s::%s()", (*ce_ptr)->name, fptr->common.function_name); + } retval = 0; } } |