From 3780b027ddce2e7dfb62228c89162480d8fbd5ff Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 5 Jul 2018 14:25:17 +0300 Subject: [PATCH] Use zval_ptr_dtor() instead of zval_dtor() in internal functions that destroy new created object (This is safer and produces less code) --- ext/phar/phar_object.c | 4 ++-- ext/reflection/php_reflection.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index f2fd426241..2e351454f3 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -1767,7 +1767,7 @@ PHP_METHOD(Phar, buildFromDirectory) if (SUCCESS != object_init_ex(®exiter, spl_ce_RegexIterator)) { zval_ptr_dtor(&iteriter); - zval_dtor(®exiter); + zval_ptr_dtor(®exiter); zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unable to instantiate regex iterator for %s", phar_obj->archive->fname); RETURN_FALSE; } @@ -2218,7 +2218,7 @@ its_ok: ZVAL_NULL(&ret); if (SUCCESS != object_init_ex(&ret, ce)) { - zval_dtor(&ret); + zval_ptr_dtor(&ret); zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unable to instantiate phar object when converting archive \"%s\"", phar->fname); return NULL; } diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index e57c388e4a..c29c354365 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -4127,7 +4127,7 @@ ZEND_METHOD(reflection_class, getMethod) /* don't assign closure_object since we only reflect the invoke handler method and not the closure definition itself */ reflection_method_factory(ce, mptr, NULL, return_value); - zval_dtor(&obj_tmp); + zval_ptr_dtor(&obj_tmp); efree(lc_name); } else if ((mptr = zend_hash_str_find_ptr(&ce->function_table, lc_name, name_len)) != NULL) { reflection_method_factory(ce, mptr, NULL, return_value); @@ -4571,7 +4571,7 @@ ZEND_METHOD(reflection_class, isCloneable) return; } RETVAL_BOOL(Z_OBJ_HANDLER(obj, clone_obj) != NULL); - zval_dtor(&obj); + zval_ptr_dtor(&obj); } } } -- 2.40.0