Author: ahristov
Date: 2008-02-21 14:09:49 +0100 (Thu, 21 Feb 2008)
New Revision: 1295
Modified:
trunk/mysqlnd/mysqlnd_debug.h
trunk/mysqlnd/mysqlnd_result.c
trunk/mysqlnd/mysqlnd_structs.h
trunk/mysqlnd/mysqlnd_wireprotocol.c
trunk/mysqlnd/mysqlnd_wireprotocol.h
Log:
Fix leak
Modified: trunk/mysqlnd/mysqlnd_debug.h
===================================================================
--- trunk/mysqlnd/mysqlnd_debug.h 2008-02-20 18:31:45 UTC (rev 1294)
+++ trunk/mysqlnd/mysqlnd_debug.h 2008-02-21 13:09:49 UTC (rev 1295)
@@ -25,7 +25,7 @@
#include "zend_stack.h"
-#define MYSQLND_DEBUG_MEMORY 0
+#define MYSQLND_DEBUG_MEMORY 1
struct st_mysqlnd_debug_methods
{
Modified: trunk/mysqlnd/mysqlnd_result.c
===================================================================
--- trunk/mysqlnd/mysqlnd_result.c 2008-02-20 18:31:45 UTC (rev 1294)
+++ trunk/mysqlnd/mysqlnd_result.c 2008-02-21 13:09:49 UTC (rev 1295)
@@ -336,6 +336,12 @@
result->lengths = NULL;
}
+ if (result->row_packet) {
+ DBG_INF("Freeing packet");
+ PACKET_FREE(result->row_packet);
+ result->row_packet = NULL;
+ }
+
DBG_VOID_RETURN;
}
/* }}} */
@@ -349,12 +355,6 @@
result->m.free_result_buffers(result TSRMLS_CC);
- if (result->row_packet) {
- DBG_INF("Freeing packet");
- PACKET_FREE(result->row_packet);
- result->row_packet = NULL;
- }
-
if (result->meta) {
result->meta->m->free_metadata(result->meta, FALSE TSRMLS_CC);
result->meta = NULL;
@@ -983,6 +983,7 @@
this to be not NULL.
*/
/* FALSE = non-persistent */
+
PACKET_INIT(result->row_packet, PROT_ROW_PACKET, php_mysql_packet_row *, FALSE);
result->row_packet->field_count = result->field_count;
result->row_packet->binary_protocol = ps;
Modified: trunk/mysqlnd/mysqlnd_structs.h
===================================================================
--- trunk/mysqlnd/mysqlnd_structs.h 2008-02-20 18:31:45 UTC (rev 1294)
+++ trunk/mysqlnd/mysqlnd_structs.h 2008-02-21 13:09:49 UTC (rev 1295)
@@ -566,7 +566,7 @@
*/
unsigned long *lengths;
- php_mysql_packet_row *row_packet; /* Unused for PS */
+ php_mysql_packet_row *row_packet;
/* zval cache */
MYSQLND_THD_ZVAL_PCACHE *zval_cache;
Modified: trunk/mysqlnd/mysqlnd_wireprotocol.c
===================================================================
--- trunk/mysqlnd/mysqlnd_wireprotocol.c 2008-02-20 18:31:45 UTC (rev 1294)
+++ trunk/mysqlnd/mysqlnd_wireprotocol.c 2008-02-21 13:09:49 UTC (rev 1295)
@@ -1672,11 +1672,13 @@
static
void php_mysqlnd_rowp_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
{
+ DBG_ENTER("php_mysqlnd_rowp_free_mem");
php_mysql_packet_row *p= (php_mysql_packet_row *) _packet;
if (p->row_buffer) {
p->row_buffer->free_chunk(p->row_buffer, TRUE TSRMLS_CC);
p->row_buffer = NULL;
}
+ DBG_INF_FMT("alloca=%d persistent=%d", (int)alloca, (int)p->header.persistent);
/*
Don't free packet->fields :
- normal queries -> store_result() | fetch_row_unbuffered() will transfer
@@ -1687,6 +1689,7 @@
if (!alloca) {
mnd_pefree(p, p->header.persistent);
}
+ DBG_VOID_RETURN;
}
/* }}} */
Modified: trunk/mysqlnd/mysqlnd_wireprotocol.h
===================================================================
--- trunk/mysqlnd/mysqlnd_wireprotocol.h 2008-02-20 18:31:45 UTC (rev 1294)
+++ trunk/mysqlnd/mysqlnd_wireprotocol.h 2008-02-21 13:09:49 UTC (rev 1295)
@@ -42,11 +42,13 @@
packet = (c_type) pecalloc(1, packet_methods[(enum_type)].struct_size, (pers)); \
((c_type) (packet))->header.m = &packet_methods[(enum_type)]; \
((c_type) (packet))->header.persistent = (pers); \
+ DBG_INF_FMT("PACKET_INIT(%p, %d, %d)", packet, (int) enum_type, (int) pers); \
}
#define PACKET_WRITE(packet, conn) ((packet)->header.m->write_to_net((packet),
(conn) TSRMLS_CC))
#define PACKET_READ(packet, conn) ((packet)->header.m->read_from_net((packet),
(conn) TSRMLS_CC))
#define PACKET_FREE(packet) \
do { \
+ DBG_INF_FMT("PACKET_FREE(%p)", packet); \
((packet)->header.m->free_mem((packet), FALSE TSRMLS_CC)); \
} while (0);
| Thread |
|---|
| • PHP mysqlnd svn commit: r1295 - trunk/mysqlnd | ahristov | 21 Feb |