From 29a82ceb56dca5336cf9f63d5abf0bfd22bf4d7a Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Fri, 7 Jan 2011 01:11:16 +0000 Subject: [PATCH] - Fixed memory leak on SQLite3Result and SQLite3Stmt when assigning to a reference. --- NEWS | 17 ++++++++++++----- ext/sqlite3/sqlite3.c | 2 +- ext/sqlite3/tests/sqlite3_prepare_001.phpt | 17 +++++++++++++++++ 3 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 ext/sqlite3/tests/sqlite3_prepare_001.phpt diff --git a/NEWS b/NEWS index cde7e9a572..eb6609bec5 100644 --- a/NEWS +++ b/NEWS @@ -77,28 +77,35 @@ . Fixed bug #53527 (php-fpm --test doesn't set a valuable return value). (fat) - SOAP extension: - . Fixed possible crash introduced by the NULL poisoning patch (Mateusz Kocielski, Pierre) + . Fixed possible crash introduced by the NULL poisoning patch. + (Mateusz Kocielski, Pierre) - SPL extension: . Fixed bug #53515 (property_exists incorrect on ArrayObject null and 0 values). (Felipe) - SQLite3 extension: - . Fixed memory leaked introduced by the NULL poisoning patch (Mateusz Kocielski, Pierre) + . Fixed memory leaked introduced by the NULL poisoning patch. + (Mateusz Kocielski, Pierre) + . Fixed memory leak on SQLite3Result and SQLite3Stmt when assigning to a + reference. (Felipe) . Add SQlite3_Stmt::readonly() for checking if a statement is read only. (Scott) - . Implemented FR #53466 (SQLite3Result::columnType() should return false after all of the rows have been fetched). (Scott) + . Implemented FR #53466 (SQLite3Result::columnType() should return false after + all of the rows have been fetched). (Scott) - Streams: . Implemented FR #26158 (open arbitrary file descriptor with fopen). (Gustavo) - XSL extension: - . Fixed memory leaked introduced by the NULL poisoning patch (Mateusz Kocielski, Pierre) + . Fixed memory leaked introduced by the NULL poisoning patch. + (Mateusz Kocielski, Pierre) - Zip extension: . Added the filename into the return value of stream_get_meta_data(). (Hannes) . Fixed bug #53568 (swapped memset arguments in struct initialization). (crrodriguez at opensuse dot org) - . Fixed bug #53579 (stream_get_contents() segfaults on ziparchive streams) (Hannes) + . Fixed bug #53579 (stream_get_contents() segfaults on ziparchive streams). + (Hannes) . Fixed bug #53603 (ZipArchive should quiet stat errors). (brad dot froehle at gmail dot com, Gustavo) diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 541c13f6c5..7c3d23335d 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -1964,7 +1964,7 @@ static void php_sqlite3_stmt_object_free_storage(void *object TSRMLS_DC) /* {{{ } if (intern->db_obj_zval) { - Z_DELREF_P(intern->db_obj_zval); + zval_ptr_dtor(&intern->db_obj_zval); } zend_object_std_dtor(&intern->zo TSRMLS_CC); diff --git a/ext/sqlite3/tests/sqlite3_prepare_001.phpt b/ext/sqlite3/tests/sqlite3_prepare_001.phpt new file mode 100644 index 0000000000..7cd4e4ccf8 --- /dev/null +++ b/ext/sqlite3/tests/sqlite3_prepare_001.phpt @@ -0,0 +1,17 @@ +--TEST-- +SQLite3 - memory leak on SQLite3Result and SQLite3Stmt +--FILE-- +prepare('SELECT 1'); +} + +test($foo); + +echo "done\n"; + +?> +--EXPECTF-- +done -- 2.40.0