From: Johannes Schlüter Date: Wed, 18 May 2011 11:49:49 +0000 (+0000) Subject: - handle out of memory X-Git-Tag: php-5.4.0alpha1~162 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0a17fe52fb2f17996413b05339989dc874c08f8f;p=php - handle out of memory --- diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index ddd8d22ee2..df9dac549b 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;