summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd_ps_codec.c
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2009-05-28 16:35:16 +0000
committerAndrey Hristov <andrey@php.net>2009-05-28 16:35:16 +0000
commit09b56ed2a5142b7a303622309ff275cac5177d05 (patch)
tree2b26b3f7c317c81fde7376f7ddf5f536d402f6e7 /ext/mysqlnd/mysqlnd_ps_codec.c
parentf9fb575cd7fbb13dfc380301ee4632905e809976 (diff)
downloadphp-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_ps_codec.c')
-rw-r--r--ext/mysqlnd/mysqlnd_ps_codec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c
index 673523c77c..6fd2e053b2 100644
--- a/ext/mysqlnd/mysqlnd_ps_codec.c
+++ b/ext/mysqlnd/mysqlnd_ps_codec.c
@@ -405,12 +405,14 @@ void ps_fetch_string(zval *zv, const MYSQLND_FIELD * const field,
DBG_ENTER("ps_fetch_string");
DBG_INF_FMT("len = %lu", length);
#if PHP_MAJOR_VERSION < 6
+ DBG_INF("copying from the row buffer");
ZVAL_STRINGL(zv, (char *)*row, length, 1);
#else
if (field->charsetnr == MYSQLND_BINARY_CHARSET_NR) {
DBG_INF("Binary charset");
ZVAL_STRINGL(zv, (char *)*row, length, 1);
} else {
+ DBG_INF_FMT("copying from the row buffer");
ZVAL_UTF8_STRINGL(zv, (char*)*row, length, ZSTR_DUPLICATE);
}
#endif