From 09b56ed2a5142b7a303622309ff275cac5177d05 Mon Sep 17 00:00:00 2001 From: Andrey Hristov Date: Thu, 28 May 2009 16:35:16 +0000 Subject: Fix a problem with cursors, which did not happen with unbuffered PS for some reason. Double free of the data, which led to valgrind warnigns. The fix actually optimizes the code in this cases because the old code used copy_ctor while the new one skips it because it is not needed. Transferring data ownership and nulling works best, for PS where we always copy the string from the result set, unlike the text protocol. --- ext/mysqlnd/mysqlnd_palloc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ext/mysqlnd/mysqlnd_palloc.c') diff --git a/ext/mysqlnd/mysqlnd_palloc.c b/ext/mysqlnd/mysqlnd_palloc.c index ca945c1901..1b035ed365 100644 --- a/ext/mysqlnd/mysqlnd_palloc.c +++ b/ext/mysqlnd/mysqlnd_palloc.c @@ -497,9 +497,14 @@ void mysqlnd_palloc_zval_ptr_dtor(zval **zv, MYSQLND_THD_ZVAL_PCACHE * const thd *(thd_cache->gc_list.last_added++) = (mysqlnd_zval *)*zv; UNLOCK_PCACHE(cache); } else { + DBG_INF("No user reference"); /* No user reference */ if (((mysqlnd_zval *)*zv)->point_type == MYSQLND_POINTS_EXT_BUFFER) { - /* PS are here and also in Unicode mode, for non-binary */ + DBG_INF("Points to external buffer. Calling zval_dtor"); + /* + PS are here + Unicode mode goes also here if the column is not binary but a text + */ zval_dtor(*zv); } LOCK_PCACHE(cache); -- cgit v1.2.1