Use zval_ptr_dtor() instead of zval_dtor() in internal functions that destroy new created object (This is safer and produces less code)

This commit is contained in:
Dmitry Stogov 2018-07-05 14:25:17 +03:00
parent 91fc0d1a41
commit 3780b027dd
2 changed files with 4 additions and 4 deletions

View File

@ -1767,7 +1767,7 @@ PHP_METHOD(Phar, buildFromDirectory)
if (SUCCESS != object_init_ex(&regexiter, spl_ce_RegexIterator)) {
zval_ptr_dtor(&iteriter);
zval_dtor(&regexiter);
zval_ptr_dtor(&regexiter);
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;
}

View File

@ -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);
}
}
}