andrey Tue, 05 Jul 2011 20:31:53 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=312953
Log:
free data in case of failure in the callee not in the caller
Changed paths:
U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c
U php/php-src/trunk/ext/mysqlnd/mysqlnd.c
Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2011-07-05 20:10:45 UTC
(rev 312952)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2011-07-05 20:31:53 UTC
(rev 312953)
@@ -156,6 +156,7 @@
mnd_pefree(conn->unix_socket, pers);
conn->unix_socket = NULL;
}
+ DBG_INF_FMT("scheme=%s", conn->scheme);
if (conn->scheme) {
DBG_INF("Freeing scheme");
mnd_pefree(conn->scheme, pers);
@@ -635,7 +636,7 @@
SET_OOM_ERROR(conn->error_info);
goto err; /* OOM */
}
- DBG_INF_FMT("transport=%s", transport);
+ DBG_INF_FMT("transport=%s conn->scheme=%s", transport,
conn->scheme);
conn->scheme = mnd_pestrndup(transport, transport_len,
conn->persistent);
conn->scheme_len = transport_len;
efree(transport); /* allocated by spprintf */
@@ -836,7 +837,7 @@
/* no mnd_ since we don't allocate it */
efree(errstr);
}
-
+ conn->m->free_contents(conn TSRMLS_CC);
MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_CONNECT_FAILURE);
DBG_RETURN(FAIL);
@@ -877,9 +878,6 @@
object - we are free to kill it!
*/
conn->m->dtor(conn TSRMLS_CC);
- } else {
- /* This will also close conn->net->stream if it has
been opened */
- conn->m->free_contents(conn TSRMLS_CC);
}
DBG_RETURN(NULL);
}
Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c 2011-07-05 20:10:45 UTC
(rev 312952)
+++ php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c 2011-07-05 20:31:53 UTC
(rev 312953)
@@ -157,6 +157,7 @@
mnd_pefree(conn->unix_socket, pers);
conn->unix_socket = NULL;
}
+ DBG_INF_FMT("scheme=%s", conn->scheme);
if (conn->scheme) {
mnd_pefree(conn->scheme, pers);
conn->scheme = NULL;
@@ -717,7 +718,7 @@
SET_OOM_ERROR(conn->error_info);
goto err; /* OOM */
}
- DBG_INF_FMT("transport=%s", transport);
+ DBG_INF_FMT("transport=%s conn->scheme=%s", transport,
conn->scheme);
conn->scheme = mnd_pestrndup(transport, transport_len,
conn->persistent);
conn->scheme_len = transport_len;
mnd_sprintf_free(transport);
@@ -936,7 +937,7 @@
/* no mnd_ since we don't allocate it */
efree(errstr);
}
-
+ conn->m->free_contents(conn TSRMLS_CC);
MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_CONNECT_FAILURE);
DBG_RETURN(FAIL);
@@ -977,9 +978,6 @@
object - we are free to kill it!
*/
conn->m->dtor(conn TSRMLS_CC);
- } else {
- /* This will also close conn->net->stream if it has
been opened */
- conn->m->free_contents(conn TSRMLS_CC);
}
DBG_RETURN(NULL);
}
Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2011-07-05 20:10:45 UTC (rev
312952)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2011-07-05 20:31:53 UTC (rev
312953)
@@ -157,6 +157,7 @@
mnd_pefree(conn->unix_socket, pers);
conn->unix_socket = NULL;
}
+ DBG_INF_FMT("scheme=%s", conn->scheme);
if (conn->scheme) {
mnd_pefree(conn->scheme, pers);
conn->scheme = NULL;
@@ -717,7 +718,7 @@
SET_OOM_ERROR(conn->error_info);
goto err; /* OOM */
}
- DBG_INF_FMT("transport=%s", transport);
+ DBG_INF_FMT("transport=%s conn->scheme=%s", transport,
conn->scheme);
conn->scheme = mnd_pestrndup(transport, transport_len,
conn->persistent);
conn->scheme_len = transport_len;
mnd_sprintf_free(transport);
@@ -936,7 +937,7 @@
/* no mnd_ since we don't allocate it */
efree(errstr);
}
-
+ conn->m->free_contents(conn TSRMLS_CC);
MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_CONNECT_FAILURE);
DBG_RETURN(FAIL);
@@ -977,9 +978,6 @@
object - we are free to kill it!
*/
conn->m->dtor(conn TSRMLS_CC);
- } else {
- /* This will also close conn->net->stream if it has
been opened */
- conn->m->free_contents(conn TSRMLS_CC);
}
DBG_RETURN(NULL);
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php