summaryrefslogtreecommitdiff
path: root/ext/mysql
diff options
context:
space:
mode:
authorJohannes Schlüter <johannes@php.net>2011-05-18 11:49:49 +0000
committerJohannes Schlüter <johannes@php.net>2011-05-18 11:49:49 +0000
commit9aa379c7248fecd453927f1f8a2ff27467b9f734 (patch)
treefdf252768f347305989fec3329175c3ae6720352 /ext/mysql
parent2ee837aa5e13d475ddfa50d946b0d1779920004c (diff)
downloadphp-git-9aa379c7248fecd453927f1f8a2ff27467b9f734.tar.gz
- handle out of memory
Diffstat (limited to 'ext/mysql')
-rw-r--r--ext/mysql/php_mysql.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index 0c41d333fe..482cb4dda0 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -830,6 +830,9 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
/* create the link */
mysql = (php_mysql_conn *) malloc(sizeof(php_mysql_conn));
+ if (!mysql) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Out of memory while allocating memory for a persistent link");
+ }
mysql->active_result_id = 0;
#ifdef CLIENT_MULTI_STATEMENTS
mysql->multi_query = client_flags & CLIENT_MULTI_STATEMENTS? 1:0;