johannes                                 Wed, 18 May 2011 11:49:49 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=311181

Log:
- handle out of memory

Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/mysql/php_mysql.c
    U   php/php-src/branches/PHP_5_4/ext/mysql/php_mysql.c
    U   php/php-src/trunk/ext/mysql/php_mysql.c

Modified: php/php-src/branches/PHP_5_3/ext/mysql/php_mysql.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysql/php_mysql.c  2011-05-18 11:33:55 UTC 
(rev 311180)
+++ php/php-src/branches/PHP_5_3/ext/mysql/php_mysql.c  2011-05-18 11:49:49 UTC 
(rev 311181)
@@ -830,6 +830,9 @@
                        }
                        /* 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;

Modified: php/php-src/branches/PHP_5_4/ext/mysql/php_mysql.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/mysql/php_mysql.c  2011-05-18 11:33:55 UTC 
(rev 311180)
+++ php/php-src/branches/PHP_5_4/ext/mysql/php_mysql.c  2011-05-18 11:49:49 UTC 
(rev 311181)
@@ -830,6 +830,9 @@
                        }
                        /* 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;

Modified: php/php-src/trunk/ext/mysql/php_mysql.c
===================================================================
--- php/php-src/trunk/ext/mysql/php_mysql.c     2011-05-18 11:33:55 UTC (rev 
311180)
+++ php/php-src/trunk/ext/mysql/php_mysql.c     2011-05-18 11:49:49 UTC (rev 
311181)
@@ -830,6 +830,9 @@
                        }
                        /* 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;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to