diff options
| author | Antony Dovgal <tony2001@php.net> | 2006-10-11 15:52:56 +0000 |
|---|---|---|
| committer | Antony Dovgal <tony2001@php.net> | 2006-10-11 15:52:56 +0000 |
| commit | aeec5b4b68d8e38b129e06eeef3d4798e88dabe6 (patch) | |
| tree | d1407f851e766132d87449facb986a2d627ae245 /ext/reflection/php_reflection.c | |
| parent | e20650616e64f4c48f0b04eea6775af06739967e (diff) | |
| download | php-git-aeec5b4b68d8e38b129e06eeef3d4798e88dabe6.tar.gz | |
MFH: fix #39125 (Memleak when reflecting non-existing class/method)
Diffstat (limited to 'ext/reflection/php_reflection.c')
| -rw-r--r-- | ext/reflection/php_reflection.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 55189cda80..22b134bba8 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2165,6 +2165,7 @@ ZEND_METHOD(reflection_method, __construct) return; } if ((tmp = strstr(name_str, "::")) == NULL) { + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Invalid method name %s", name_str); return; } classname = &ztmp; @@ -2186,6 +2187,9 @@ ZEND_METHOD(reflection_method, __construct) if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRLEN_P(classname), &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(classname)); + if (classname == &ztmp) { + zval_dtor(&ztmp); + } return; } ce = *pce; @@ -2196,6 +2200,9 @@ ZEND_METHOD(reflection_method, __construct) break; default: + if (classname == &ztmp) { + zval_dtor(&ztmp); + } _DO_THROW("The parameter class is expected to be either a string or an object"); /* returns out of this function */ } |
