diff options
author | Andrey Hristov <andrey@php.net> | 2009-05-28 16:35:16 +0000 |
---|---|---|
committer | Andrey Hristov <andrey@php.net> | 2009-05-28 16:35:16 +0000 |
commit | 09b56ed2a5142b7a303622309ff275cac5177d05 (patch) | |
tree | 2b26b3f7c317c81fde7376f7ddf5f536d402f6e7 /ext/mysqlnd/mysqlnd_palloc.c | |
parent | f9fb575cd7fbb13dfc380301ee4632905e809976 (diff) | |
download | php-git-09b56ed2a5142b7a303622309ff275cac5177d05.tar.gz |
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.
Diffstat (limited to 'ext/mysqlnd/mysqlnd_palloc.c')
-rw-r--r-- | ext/mysqlnd/mysqlnd_palloc.c | 7 |
1 files changed, 6 insertions, 1 deletions
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); |