diff options
author | Felipe Pena <felipe@php.net> | 2021-02-25 20:53:14 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2021-02-25 20:53:14 +0000 |
commit | 988c3f965923e5418b78ce69055f3eadd8ce4c89 (patch) | |
tree | b902815287461c6f4f7dee493f4765fdbeb07a8b /ext/reflection/php_reflection.c | |
parent | ae0585c98e91495d8b86bee69de81c47800c1cf2 (diff) | |
download | php-git-988c3f965923e5418b78ce69055f3eadd8ce4c89.tar.gz |
Fix memleak on ReflectionFunction and ReflectionGenerator classes when calling __construct after instantiation
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r-- | ext/reflection/php_reflection.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 6384e2b410..a358994fd5 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1534,6 +1534,11 @@ ZEND_METHOD(reflection_function, __construct) } } + if (intern->ptr) { + zval_ptr_dtor(&intern->obj); + zval_ptr_dtor(reflection_prop_name(object)); + } + ZVAL_STR_COPY(reflection_prop_name(object), fptr->common.function_name); intern->ptr = fptr; intern->ref_type = REF_TYPE_FUNCTION; @@ -2073,6 +2078,10 @@ ZEND_METHOD(reflection_generator, __construct) return; } + if (intern->ce) { + zval_ptr_dtor(&intern->obj); + } + intern->ref_type = REF_TYPE_GENERATOR; Z_ADDREF_P(generator); ZVAL_OBJ(&intern->obj, Z_OBJ_P(generator)); |