summaryrefslogtreecommitdiff
path: root/ext/mysqli/mysqli_nonapi.c
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2010-09-30 18:10:03 +0000
committerAndrey Hristov <andrey@php.net>2010-09-30 18:10:03 +0000
commit77d73b814bc388e7dab0a68d371c03b7189f63b2 (patch)
treeb6933761ee0dd634ea96d346bc5d0e62cae93be8 /ext/mysqli/mysqli_nonapi.c
parent53d3320951d731c15ae9adfecb4881e94c230e37 (diff)
downloadphp-git-77d73b814bc388e7dab0a68d371c03b7189f63b2.tar.gz
Plug a leak in mysqli when in the same script
a pconn is reused. Call end_psession earlier - so will mysqlnd and the plugins free data earlier.
Diffstat (limited to 'ext/mysqli/mysqli_nonapi.c')
-rw-r--r--ext/mysqli/mysqli_nonapi.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c
index 1f52c858a0..65d2ef0aa5 100644
--- a/ext/mysqli/mysqli_nonapi.c
+++ b/ext/mysqli/mysqli_nonapi.c
@@ -123,7 +123,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
flags &= ~CLIENT_LOCAL_FILES;
}
}
- if (mysql->mysql && mysqli_resource && mysqli_resource->status > MYSQLI_STATUS_INITIALIZED) {
+ if (mysql->mysql && mysqli_resource && (mysqli_resource->status > MYSQLI_STATUS_INITIALIZED || (strlen(SAFE_STR(hostname)) > 2 && !strncasecmp(hostname, "p:", 2)))) {
/* already connected, we should close the connection */
php_mysqli_close(mysql, MYSQLI_CLOSE_IMPLICIT, mysqli_resource->status TSRMLS_CC);
}
@@ -168,9 +168,6 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
mysql->mysql = zend_ptr_stack_pop(&plist->free_links);
MyG(num_inactive_persistent)--;
-#if defined(MYSQLI_USE_MYSQLND)
- mysqlnd_end_psession(mysql->mysql);
-#endif
/* reset variables */
#ifndef MYSQLI_NO_CHANGE_USER_ON_PCONNECT