summaryrefslogtreecommitdiff
path: root/ext/mysql
diff options
context:
space:
mode:
authorJohannes Schlüter <johannes@php.net>2011-05-18 11:49:49 (GMT)
committerJohannes Schlüter <johannes@php.net>2011-05-18 11:49:49 (GMT)
commit5d6b3ca113c1c643f44efeaa6109aab0eba00cc8 (patch)
tree3690470e65b1f982358b3b7cdca2c810cecee7e8 /ext/mysql
parentf0b306af39208929c151a6dcfd6b2b374d091bf1 (diff)
downloadphp-5d6b3ca113c1c643f44efeaa6109aab0eba00cc8.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 ddd8d22..df9dac5 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;