diff options
| author | Adam Harvey <aharvey@php.net> | 2015-09-24 14:16:45 +0200 |
|---|---|---|
| committer | Adam Harvey <aharvey@php.net> | 2015-09-24 14:16:45 +0200 |
| commit | 6413ecb4390d6b0f5e452a5d8f72f847fb04fa04 (patch) | |
| tree | edf86eddd8e6db469bd52407364c602d1ef29b92 /ext/sqlite3/sqlite3.c | |
| parent | 2d55e8c186ef1034c2af64478da8f23dbeb28be9 (diff) | |
| download | php-git-6413ecb4390d6b0f5e452a5d8f72f847fb04fa04.tar.gz | |
Fix a memory leak in sqlite3_do_callback.
This was very, very obvious when using a debug build of PHP to build the
manual!
Fixes bug #70571 (Memory leak in sqlite3_do_callback).
Diffstat (limited to 'ext/sqlite3/sqlite3.c')
| -rw-r--r-- | ext/sqlite3/sqlite3.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 16d37aea9d..cc9c5f57a9 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -714,7 +714,7 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s if (Z_ISUNDEF(agg_context->zval_context)) { ZVAL_NULL(&agg_context->zval_context); } - ZVAL_COPY_VALUE(&zargs[0], &agg_context->zval_context); + ZVAL_DUP(&zargs[0], &agg_context->zval_context); ZVAL_LONG(&zargs[1], agg_context->row_count); } @@ -750,6 +750,10 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s php_error_docref(NULL, E_WARNING, "An error occurred while invoking the callback"); } + if (is_agg) { + zval_ptr_dtor(&zargs[0]); + } + /* clean up the params */ if (fake_argc) { for (i = is_agg; i < argc + is_agg; i++) { |
