Author: ahristov
Date: 2007-04-24 13:45:43 +0200 (Tue, 24 Apr 2007)
New Revision: 344
Modified:
trunk/mysqlnd/mysqlnd.c
trunk/mysqlnd/mysqlnd_palloc.c
Log:
Fix a leak and add a comment about possible problem in ZTS.
Modified: trunk/mysqlnd/mysqlnd.c
===================================================================
--- trunk/mysqlnd/mysqlnd.c 2007-04-18 20:31:58 UTC (rev 343)
+++ trunk/mysqlnd/mysqlnd.c 2007-04-24 11:45:43 UTC (rev 344)
@@ -49,6 +49,10 @@
sent to the network like writev() and this can save at least for
mysqlnd_stmt_send_long_data() new malloc. This change will probably make the
code in few other places cleaner.
+
+ - We have to thread_id, given back from tsrm_thread_id() in ZTS
+ to `mysqlnd_zval` so a thread will clean only its variables, and not
+ verything, which will lead to a crash in a MT environment.
*/
extern MYSQLND_CHARSET *mysqlnd_charsets;
Modified: trunk/mysqlnd/mysqlnd_palloc.c
===================================================================
--- trunk/mysqlnd/mysqlnd_palloc.c 2007-04-18 20:31:58 UTC (rev 343)
+++ trunk/mysqlnd/mysqlnd_palloc.c 2007-04-24 11:45:43 UTC (rev 344)
@@ -418,11 +418,18 @@
return;
}
+ /*
+ XXX: We have to thread_id, given back from tsrm_thread_id() in ZTS
+ to `mysqlnd_zval` so a thread will clean only its variables, and not
+ everything, which will lead to a crash in a MT environment.
+
+ */
LOCK_PCACHE(cache);
for (i = 0; i < cache->max_items; i++) {
if (cache->block[i].copy_alloced_on_free_result == TRUE) {
zval_dtor(&(cache->block[i].zv));
cache->block[i].copy_alloced_on_free_result = FALSE;
+ ++cache->free_items;
}
}
UNLOCK_PCACHE(cache);
| Thread |
|---|
| • PHP mysqlnd svn commit: r344 - trunk/mysqlnd | ahristov | 24 Apr |