com php-src: Use stack allocated zvals: ext/sqlite3/sqlite3.c ext/standard/assert.c

From: Date: Sun, 07 Jan 2018 12:03:49 +0000
Subject: com php-src: Use stack allocated zvals: ext/sqlite3/sqlite3.c ext/standard/assert.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-100809@lists.php.net to get a copy of this message
Commit: 88b8cd7385c57791cc75128e84943316ec426584 Author: Xinchen Hui <laruence@gmail.com> Sun, 7 Jan 2018 20:03:49 +0800 Parents: 4a8229b80dceeb724ccdfdb0b90c2f2ecb634ffd Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=88b8cd7385c57791cc75128e84943316ec426584 Log: Use stack allocated zvals Changed paths: M ext/sqlite3/sqlite3.c M ext/standard/assert.c Diff: diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 250e41d..232a56d 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 1f8a4ef..3cf3a02 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); }

« previous php.cvs (#100809) next »