summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2011-01-07 01:11:16 +0000
committerFelipe Pena <felipe@php.net>2011-01-07 01:11:16 +0000
commitd3e6f27a7614f0e7cadb959bcd86a386ec276ce6 (patch)
tree100fb506b70969563c45b00a781ba32767c64f2f
parentdc444e8a3705981bacb47b263575c2b5ec0e478e (diff)
downloadphp-git-d3e6f27a7614f0e7cadb959bcd86a386ec276ce6.tar.gz
- Fixed memory leak on SQLite3Result and SQLite3Stmt when assigning to a reference.
-rw-r--r--ext/sqlite3/sqlite3.c2
-rw-r--r--ext/sqlite3/tests/sqlite3_prepare_001.phpt17
2 files changed, 18 insertions, 1 deletions
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index cc33112242..65f4a231dd 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -1961,7 +1961,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--
+<?php
+
+function test(&$x) {
+ $class = new SQLite3(':memory:');
+ $x = $class->prepare('SELECT 1');
+}
+
+test($foo);
+
+echo "done\n";
+
+?>
+--EXPECTF--
+done