Re: com php-src: Fix a memory leak in sqlite3_do_callback.: NEWS ext/sqlite3/sqlite3.c

From: Date: Thu, 24 Sep 2015 13:18:19 +0000
Subject: Re: com php-src: Fix a memory leak in sqlite3_do_callback.: NEWS ext/sqlite3/sqlite3.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-89157@lists.php.net to get a copy of this message
On Thu, Sep 24, 2015 at 8:16 PM, Adam Harvey <aharvey@php.net> wrote: > Commit: 6413ecb4390d6b0f5e452a5d8f72f847fb04fa04 > Author: Adam Harvey <aharvey@php.net> Thu, 24 Sep 2015 > 14:16:45 +0200 > Parents: 2d55e8c186ef1034c2af64478da8f23dbeb28be9 > Branches: PHP-7.0 master > > Link: > > http://git.php.net/?p=php-src.git;a=commitdiff;h=6413ecb4390d6b0f5e452a5d8f72f847fb04fa04 > > Log: > 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). > > Bugs: > https://bugs.php.net/70571 > > Changed paths: > M NEWS > M ext/sqlite3/sqlite3.c > > > Diff: > diff --git a/NEWS b/NEWS > index 41ef2ba..92230ea 100644 > --- a/NEWS > +++ b/NEWS > @@ -40,6 +40,9 @@ PHP > NEWS > . Fixed bug #70529 (Session read causes "String is not zero-terminated" > error). > (Yasuo) > > +- SQLite3: > + . Fixed bug #70571 (Memory leak in sqlite3_do_callback). (Adam) > + > - XMLRPC > . Fixed bug #70526 (xmlrpc_set_type returns false on success). > (Laruence) > > diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c > index 16d37ae..cc9c5f5 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++) { > Why does this need a DUP rather than simple COPY? Nikita

« previous php.cvs (#89157) next »