summaryrefslogtreecommitdiff
path: root/ext/sqlite3/sqlite3.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2018-01-07 20:03:49 +0800
committerXinchen Hui <laruence@gmail.com>2018-01-07 20:03:49 +0800
commit88b8cd7385c57791cc75128e84943316ec426584 (patch)
treea1fdcb7f13ac9b0d51f9617c3be296ebdf10a51d /ext/sqlite3/sqlite3.c
parent4a8229b80dceeb724ccdfdb0b90c2f2ecb634ffd (diff)
downloadphp-git-88b8cd7385c57791cc75128e84943316ec426584.tar.gz
Use stack allocated zvals
Diffstat (limited to 'ext/sqlite3/sqlite3.c')
-rw-r--r--ext/sqlite3/sqlite3.c4
1 files changed, 1 insertions, 3 deletions
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;