diff options
author | Andrey Hristov <andrey@php.net> | 2009-05-28 16:35:41 +0000 |
---|---|---|
committer | Andrey Hristov <andrey@php.net> | 2009-05-28 16:35:41 +0000 |
commit | 76d091d5f55d69cd275feda5d8ac70cd42abbd3a (patch) | |
tree | 64ea8dc806bd8ccfb08a6c8d961cd9b36453b208 /ext/mysqlnd/mysqlnd_ps_codec.c | |
parent | 4645f513604d02c1a2772e3618dff1d3f1c85bdd (diff) | |
download | php-git-76d091d5f55d69cd275feda5d8ac70cd42abbd3a.tar.gz |
MFH: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.c | 2 |
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 |