]> granicus.if.org Git - php/commitdiff
- handle out of memory
authorJohannes Schlüter <johannes@php.net>
Wed, 18 May 2011 11:49:49 +0000 (11:49 +0000)
committerJohannes Schlüter <johannes@php.net>
Wed, 18 May 2011 11:49:49 +0000 (11:49 +0000)
ext/mysql/php_mysql.c

index 0c41d333fe12a2749199e75d6b32704e9eef5d36..482cb4dda06043eeff88883565004216afc06893 100644 (file)
@@ -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;