summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd.c
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2013-01-15 12:19:52 +0100
committerAndrey Hristov <andrey@php.net>2013-01-15 12:19:52 +0100
commitacc24d1f9eb1f5dddc89123baca14e70be84be20 (patch)
treeb934c44cde2b8ec5eb0d8414e6442093e878f1b0 /ext/mysqlnd/mysqlnd.c
parentd377a266b27e0d0b2ac088333564f8d1f05cceb8 (diff)
downloadphp-git-acc24d1f9eb1f5dddc89123baca14e70be84be20.tar.gz
Use two dtors thus allow allocation based on the alloc model of the
connection.
Diffstat (limited to 'ext/mysqlnd/mysqlnd.c')
-rw-r--r--ext/mysqlnd/mysqlnd.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c
index f5b10632d2..96c420dee9 100644
--- a/ext/mysqlnd/mysqlnd.c
+++ b/ext/mysqlnd/mysqlnd.c
@@ -2418,14 +2418,28 @@ end:
/* }}} */
-/* {{{ connect_attr_item_dtor */
+/* {{{ connect_attr_item_edtor */
static void
-connect_attr_item_dtor(void * pDest)
+connect_attr_item_edtor(void * pDest)
{
#ifdef ZTS
TSRMLS_FETCH();
#endif
- DBG_ENTER("connect_attr_item_dtor");
+ DBG_ENTER("connect_attr_item_edtor");
+ mnd_efree(*(char **) pDest);
+ DBG_VOID_RETURN;
+}
+/* }}} */
+
+
+/* {{{ connect_attr_item_pdtor */
+static void
+connect_attr_item_pdtor(void * pDest)
+{
+#ifdef ZTS
+ TSRMLS_FETCH();
+#endif
+ DBG_ENTER("connect_attr_item_pdtor");
mnd_pefree(*(char **) pDest, 1);
DBG_VOID_RETURN;
}
@@ -2456,11 +2470,11 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_client_option_2d)(MYSQLND_CONN_DATA * cons
if (!conn->options->connect_attr) {
goto oom;
}
- zend_hash_init(conn->options->connect_attr, 0, NULL, connect_attr_item_dtor, conn->persistent);
+ zend_hash_init(conn->options->connect_attr, 0, NULL, conn->persistent? connect_attr_item_pdtor:connect_attr_item_edtor, conn->persistent);
}
DBG_INF_FMT("Adding [%s][%s]", key, value);
{
- const char * copyv = mnd_pestrdup(value, 1);
+ const char * copyv = mnd_pestrdup(value, conn->persistent);
if (!copyv) {
goto oom;
}