From: Andrey Hristov Date: Tue, 15 Jan 2013 11:19:52 +0000 (+0100) Subject: Use two dtors thus allow allocation based on the alloc model of the X-Git-Tag: php-5.5.0alpha5~66 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=acc24d1f9eb1f5dddc89123baca14e70be84be20;p=php Use two dtors thus allow allocation based on the alloc model of the connection. --- diff --git a/ext/date/php_date.c b/ext/date/php_date.c index cc83130e1c..1e1e239456 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2071,7 +2071,7 @@ static zval* date_clone_immutable(zval *object) zval *new_object; ALLOC_ZVAL(new_object); - Z_OBJVAL_P(new_object) = date_object_clone_date(object); +// Z_OBJVAL_P(new_object) = date_object_clone_date(object); Z_SET_REFCOUNT_P(new_object, 1); Z_SET_ISREF_P(new_object); Z_TYPE_P(new_object) = IS_OBJECT; 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; }