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
commit60327d87a7599ce5288a9fb7675f20f3ec29c7ff (patch)
tree645dd352c9ac5c2f6dce41feac3b7c11182c839e /ext/mysqli/mysqli_nonapi.c
parent5c6f0ebeabd5ee4d8bd79f158fd7ee968ac28c0d (diff)
downloadphp-git-60327d87a7599ce5288a9fb7675f20f3ec29c7ff.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 3c075970bb..4334fc53c9 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