Author: ahristov
Date: 2007-04-18 18:13:59 +0200 (Wed, 18 Apr 2007)
New Revision: 341
Modified:
trunk/php6/ext/mysqli/mysqli_warning.c
Log:
Fix valgrind problem, how it was hiding...
Modified: trunk/php6/ext/mysqli/mysqli_warning.c
===================================================================
--- trunk/php6/ext/mysqli/mysqli_warning.c 2007-04-17 23:04:44 UTC (rev 340)
+++ trunk/php6/ext/mysqli/mysqli_warning.c 2007-04-18 16:13:59 UTC (rev 341)
@@ -138,8 +138,8 @@
for (;;) {
zval **entry;
int errno;
+
MAKE_STD_ZVAL(row);
-
mysqlnd_fetch_into(result, MYSQLND_FETCH_NUM, row);
if (Z_TYPE_P(row) != IS_ARRAY) {
zval_ptr_dtor(&row);
@@ -159,7 +159,11 @@
zend_hash_get_current_data(Z_ARRVAL_P(row), (void **)&entry);
w = php_new_warning(*entry, errno TSRMLS_CC);
- zval_ptr_dtor(entry);
+ /*
+ Don't destroy entry, because the row destroy will decrease
+ the refcounter. Decreased twice then mysqlnd_free_result()
+ will crash, because it will try to access already freed memory.
+ */
if (!first) {
first = w;
}
@@ -170,7 +174,7 @@
zval_ptr_dtor(&row);
}
-
+
mysql_free_result(result);
return first;
}
| Thread |
|---|
| • PHP mysqlnd svn commit: r341 - trunk/php6/ext/mysqli | ahristov | 18 Apr |