From: Xinchen Hui Date: Sun, 7 Jan 2018 12:03:49 +0000 (+0800) Subject: Use stack allocated zvals X-Git-Tag: php-7.3.0alpha1~683 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=88b8cd7385c57791cc75128e84943316ec426584;p=php Use stack allocated zvals --- diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 250e41d8ff..232a56dd49 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -858,7 +858,7 @@ static void php_sqlite3_callback_final(sqlite3_context *context) /* {{{ */ static int php_sqlite3_callback_compare(void *coll, int a_len, const void *a, int b_len, const void* b) /* {{{ */ { php_sqlite3_collation *collation = (php_sqlite3_collation*)coll; - zval *zargs = NULL; + zval zargs[2]; zval retval; int ret; @@ -868,7 +868,6 @@ static int php_sqlite3_callback_compare(void *coll, int a_len, const void *a, in collation->fci.fci.retval = &retval; collation->fci.fci.param_count = 2; - zargs = safe_emalloc(2, sizeof(zval), 0); ZVAL_STRINGL(&zargs[0], a, a_len); ZVAL_STRINGL(&zargs[1], b, b_len); @@ -885,7 +884,6 @@ static int php_sqlite3_callback_compare(void *coll, int a_len, const void *a, in zval_ptr_dtor(&zargs[0]); zval_ptr_dtor(&zargs[1]); - efree(zargs); if (EG(exception)) { ret = 0; diff --git a/ext/standard/assert.c b/ext/standard/assert.c index 1f8a4eff78..3cf3a02830 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -216,7 +216,7 @@ PHP_FUNCTION(assert) } if (Z_TYPE(ASSERTG(callback)) != IS_UNDEF) { - zval *args = safe_emalloc(!description ? 3 : 4, sizeof(zval), 0); + zval args[4]; zval retval; int i; uint32_t lineno = zend_get_executed_lineno(); @@ -242,7 +242,6 @@ PHP_FUNCTION(assert) } } - efree(args); zval_ptr_dtor(&retval); }