andrey Fri, 21 May 2010 13:06:52 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=299578
Log:
When OOM hits the wire, don't crash.
Changed paths:
U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
U php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c
Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c 2010-05-21
12:16:07 UTC (rev 299577)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c 2010-05-21
13:06:52 UTC (rev 299578)
@@ -1,4 +1,4 @@
-;/*
+/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
@@ -679,7 +679,7 @@
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
- if (collect_memory_statistics) {
+ if (ret && collect_memory_statistics) {
*(size_t *) ret = size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_EMALLOC_COUNT,
1, STAT_MEM_EMALLOC_AMOUNT, size);
}
@@ -711,7 +711,7 @@
DBG_INF_FMT("size=%lu ptr=%p persistent=%d", size, ret, persistent);
- if (collect_memory_statistics) {
+ if (ret && collect_memory_statistics) {
enum mysqlnd_collected_stats s1 = persistent?
STAT_MEM_MALLOC_COUNT:STAT_MEM_EMALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent?
STAT_MEM_MALLOC_AMOUNT:STAT_MEM_EMALLOC_AMOUNT;
*(size_t *) ret = size;
@@ -747,7 +747,7 @@
DBG_INF_FMT("after : %lu", zend_memory_usage(FALSE TSRMLS_CC));
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
- if (collect_memory_statistics) {
+ if (ret && collect_memory_statistics) {
*(size_t *) ret = size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_ECALLOC_COUNT,
1, STAT_MEM_ECALLOC_AMOUNT, size);
}
@@ -779,7 +779,7 @@
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
- if (collect_memory_statistics) {
+ if (ret && collect_memory_statistics) {
enum mysqlnd_collected_stats s1 = persistent?
STAT_MEM_CALLOC_COUNT:STAT_MEM_ECALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent?
STAT_MEM_CALLOC_AMOUNT:STAT_MEM_ECALLOC_AMOUNT;
*(size_t *) ret = size;
@@ -815,7 +815,7 @@
#endif
DBG_INF_FMT("new_ptr=%p", (char*)ret);
- if (collect_memory_statistics) {
+ if (ret && collect_memory_statistics) {
*(size_t *) ret = new_size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_EREALLOC_COUNT,
1, STAT_MEM_EREALLOC_AMOUNT, new_size);
}
@@ -849,7 +849,7 @@
DBG_INF_FMT("new_ptr=%p", (char*)ret);
- if (collect_memory_statistics) {
+ if (ret && collect_memory_statistics) {
enum mysqlnd_collected_stats s1 = persistent?
STAT_MEM_REALLOC_COUNT:STAT_MEM_EREALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent?
STAT_MEM_REALLOC_AMOUNT:STAT_MEM_EREALLOC_AMOUNT;
*(size_t *) ret = new_size;
Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c 2010-05-21 12:16:07 UTC
(rev 299577)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c 2010-05-21 13:06:52 UTC
(rev 299578)
@@ -1,4 +1,4 @@
-;/*
+/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
@@ -679,7 +679,7 @@
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
- if (collect_memory_statistics) {
+ if (ret && collect_memory_statistics) {
*(size_t *) ret = size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_EMALLOC_COUNT,
1, STAT_MEM_EMALLOC_AMOUNT, size);
}
@@ -711,7 +711,7 @@
DBG_INF_FMT("size=%lu ptr=%p persistent=%d", size, ret, persistent);
- if (collect_memory_statistics) {
+ if (ret && collect_memory_statistics) {
enum mysqlnd_collected_stats s1 = persistent?
STAT_MEM_MALLOC_COUNT:STAT_MEM_EMALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent?
STAT_MEM_MALLOC_AMOUNT:STAT_MEM_EMALLOC_AMOUNT;
*(size_t *) ret = size;
@@ -747,7 +747,7 @@
DBG_INF_FMT("after : %lu", zend_memory_usage(FALSE TSRMLS_CC));
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
- if (collect_memory_statistics) {
+ if (ret && collect_memory_statistics) {
*(size_t *) ret = size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_ECALLOC_COUNT,
1, STAT_MEM_ECALLOC_AMOUNT, size);
}
@@ -779,7 +779,7 @@
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
- if (collect_memory_statistics) {
+ if (ret && collect_memory_statistics) {
enum mysqlnd_collected_stats s1 = persistent?
STAT_MEM_CALLOC_COUNT:STAT_MEM_ECALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent?
STAT_MEM_CALLOC_AMOUNT:STAT_MEM_ECALLOC_AMOUNT;
*(size_t *) ret = size;
@@ -815,7 +815,7 @@
#endif
DBG_INF_FMT("new_ptr=%p", (char*)ret);
- if (collect_memory_statistics) {
+ if (ret && collect_memory_statistics) {
*(size_t *) ret = new_size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_EREALLOC_COUNT,
1, STAT_MEM_EREALLOC_AMOUNT, new_size);
}
@@ -849,7 +849,7 @@
DBG_INF_FMT("new_ptr=%p", (char*)ret);
- if (collect_memory_statistics) {
+ if (ret && collect_memory_statistics) {
enum mysqlnd_collected_stats s1 = persistent?
STAT_MEM_REALLOC_COUNT:STAT_MEM_EREALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent?
STAT_MEM_REALLOC_AMOUNT:STAT_MEM_EREALLOC_AMOUNT;
*(size_t *) ret = new_size;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php