andrey Mon Feb 4 17:32:43 2008 UTC
Modified files:
/php-src/ext/mysqli/tests bug35759.phpt
/php-src/ext/mysqlnd mysqlnd_block_alloc.c mysqlnd_result.c
Log:
Fix a leak and memory warning.
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/bug35759.phpt?r1=1.4&r2=1.5&diff_format=u
Index: php-src/ext/mysqli/tests/bug35759.phpt
diff -u php-src/ext/mysqli/tests/bug35759.phpt:1.4
php-src/ext/mysqli/tests/bug35759.phpt:1.5
--- php-src/ext/mysqli/tests/bug35759.phpt:1.4 Thu Aug 9 09:43:28 2007
+++ php-src/ext/mysqli/tests/bug35759.phpt Mon Feb 4 17:32:43 2008
@@ -32,7 +32,9 @@
$stmt = $mysql->prepare("SELECT * FROM blobby");
$stmt->execute();
$stmt->store_result();
- $params= array_pad(array(), $col_num, "");
+ for ($i = 0; $i < $col_num; $i++) {
+ $params[] = &$col_num;
+ }
call_user_func_array(array($stmt, "bind_result"), $params);
$stmt->fetch();
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd_block_alloc.c?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/mysqlnd/mysqlnd_block_alloc.c
diff -u php-src/ext/mysqlnd/mysqlnd_block_alloc.c:1.3
php-src/ext/mysqlnd/mysqlnd_block_alloc.c:1.4
--- php-src/ext/mysqlnd/mysqlnd_block_alloc.c:1.3 Tue Jan 29 22:06:16 2008
+++ php-src/ext/mysqlnd/mysqlnd_block_alloc.c Mon Feb 4 17:32:43 2008
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mysqlnd_block_alloc.c,v 1.3 2008/01/29 22:06:16 rrichards Exp $ */
+/* $Id: mysqlnd_block_alloc.c,v 1.4 2008/02/04 17:32:43 andrey Exp $ */
#include "php.h"
#include "mysqlnd.h"
@@ -186,6 +186,7 @@
/* mnd_free will reference LOCK_access and might crash, depending on
the caller...*/
mysqlnd_mempool_free_contents(pool TSRMLS_CC);
mnd_free(pool->arena);
+ mnd_free(pool);
DBG_VOID_RETURN;
}
/* }}} */
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd_result.c?r1=1.15&r2=1.16&diff_format=u
Index: php-src/ext/mysqlnd/mysqlnd_result.c
diff -u php-src/ext/mysqlnd/mysqlnd_result.c:1.15
php-src/ext/mysqlnd/mysqlnd_result.c:1.16
--- php-src/ext/mysqlnd/mysqlnd_result.c:1.15 Tue Jan 29 22:06:16 2008
+++ php-src/ext/mysqlnd/mysqlnd_result.c Mon Feb 4 17:32:43 2008
@@ -18,8 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mysqlnd_result.c,v 1.15 2008/01/29 22:06:16 rrichards Exp $ */
-
+/* $Id: mysqlnd_result.c,v 1.16 2008/02/04 17:32:43 andrey Exp $ */
#include "php.h"
#include "mysqlnd.h"
#include "mysqlnd_wireprotocol.h"
@@ -352,8 +351,6 @@
result->row_packet = NULL;
}
- result->conn = NULL;
-
if (result->meta) {
result->meta->m->free_metadata(result->meta, FALSE TSRMLS_CC);
result->meta = NULL;
@@ -375,12 +372,14 @@
void mysqlnd_internal_free_result(MYSQLND_RES *result TSRMLS_DC)
{
DBG_ENTER("mysqlnd_internal_free_result");
+
+ result->m.free_result_contents(result TSRMLS_CC);
+
if (result->conn) {
result->conn->m->free_reference(result->conn TSRMLS_CC);
result->conn = NULL;
}
- result->m.free_result_contents(result TSRMLS_CC);
efree(result);
DBG_VOID_RETURN;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php