diff options
| author | Dmitry Stogov <dmitry@zend.com> | 2018-03-06 14:59:30 +0300 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@zend.com> | 2018-03-06 14:59:30 +0300 |
| commit | a7f83f474cb9fcec5db08a25da58a63d03a5b5dc (patch) | |
| tree | 07111ef7a7a7d2d1470e7e0789da8c9dcc536424 /Zend/zend_opcode.c | |
| parent | c060d88c3652e771628b1c14a3fe87d99e3122a4 (diff) | |
| download | php-git-a7f83f474cb9fcec5db08a25da58a63d03a5b5dc.tar.gz | |
Memory leak fix, for arg_info of internal functions with type hints (ZTS build only).
Diffstat (limited to 'Zend/zend_opcode.c')
| -rw-r--r-- | Zend/zend_opcode.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 11194bc51c..5e7164c324 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -141,7 +141,7 @@ ZEND_API void zend_function_dtor(zval *zv) ZEND_ASSERT(function->type == ZEND_INTERNAL_FUNCTION); ZEND_ASSERT(function->common.function_name); zend_string_release(function->common.function_name); -#ifndef ZTS + if ((function->common.fn_flags & (ZEND_ACC_HAS_RETURN_TYPE|ZEND_ACC_HAS_TYPE_HINTS)) && !function->common.scope && function->common.arg_info) { @@ -159,7 +159,7 @@ ZEND_API void zend_function_dtor(zval *zv) } free(arg_info); } -#endif + if (!(function->common.fn_flags & ZEND_ACC_ARENA_ALLOCATED)) { pefree(function, 1); } @@ -245,9 +245,7 @@ ZEND_API void destroy_zend_class(zval *zv) { zend_property_info *prop_info; zend_class_entry *ce = Z_PTR_P(zv); -#ifndef ZTS zend_function *fn; -#endif if (--ce->refcount > 0) { return; @@ -331,7 +329,8 @@ ZEND_API void destroy_zend_class(zval *zv) } zend_hash_destroy(&ce->properties_info); zend_string_release(ce->name); -#ifndef ZTS + + /* TODO: eliminate this loop for classes without functions with arg_info */ ZEND_HASH_FOREACH_PTR(&ce->function_table, fn) { if ((fn->common.fn_flags & (ZEND_ACC_HAS_RETURN_TYPE|ZEND_ACC_HAS_TYPE_HINTS)) && fn->common.scope == ce) { @@ -339,7 +338,7 @@ ZEND_API void destroy_zend_class(zval *zv) fn->common.scope = NULL; } } ZEND_HASH_FOREACH_END(); -#endif + zend_hash_destroy(&ce->function_table); if (zend_hash_num_elements(&ce->constants_table)) { zend_class_constant *c; |
