]> granicus.if.org Git - php/commitdiff
- Fixed memory leak on SQLite3Result and SQLite3Stmt when assigning to a reference.
authorFelipe Pena <felipe@php.net>
Fri, 7 Jan 2011 01:11:16 +0000 (01:11 +0000)
committerFelipe Pena <felipe@php.net>
Fri, 7 Jan 2011 01:11:16 +0000 (01:11 +0000)
NEWS
ext/sqlite3/sqlite3.c
ext/sqlite3/tests/sqlite3_prepare_001.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index cde7e9a5724c6a6b37c4f23eb78c5eb1090209d9..eb6609bec5014beb4df364400eca99bdab4a1158 100644 (file)
--- a/NEWS
+++ b/NEWS
   . 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)
 
index 541c13f6c58d68c1b15571fad0b30ce688fbddb5..7c3d23335d4e4e245d26118fc2446e59e0ec0044 100644 (file)
@@ -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 (file)
index 0000000..7cd4e4c
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+SQLite3 - memory leak on SQLite3Result and SQLite3Stmt
+--FILE--
+<?php
+
+function test(&$x) {
+       $class = new SQLite3(':memory:');
+       $x = $class->prepare('SELECT 1');
+}
+
+test($foo);
+
+echo "done\n";
+
+?>
+--EXPECTF--
+done