summaryrefslogtreecommitdiff
path: root/ext/mysql/php_mysql.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mysql/php_mysql.c')
-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 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;