pajoye Mon, 07 Feb 2011 10:25:34 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=308090
Log:
- null deref fix
Changed paths:
U php/php-src/branches/PHP_5_3/Zend/zend_alloc.c
U php/php-src/trunk/Zend/zend_alloc.c
Modified: php/php-src/branches/PHP_5_3/Zend/zend_alloc.c
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_alloc.c 2011-02-07 10:17:14 UTC
(rev 308089)
+++ php/php-src/branches/PHP_5_3/Zend/zend_alloc.c 2011-02-07 10:25:34 UTC
(rev 308090)
@@ -241,6 +241,10 @@
return NULL;
}
storage = (zend_mm_storage*)malloc(sizeof(zend_mm_storage));
+ if (storage == NULL) {
+ HeapDestroy(heap);
+ return NULL;
+ }
storage->data = (void*) heap;
return storage;
}
@@ -1066,7 +1070,13 @@
storage->handlers = handlers;
heap = malloc(sizeof(struct _zend_mm_heap));
-
+ if (heap == NULL) {
+ fprintf(stderr, "Cannot allocate heap for zend_mm storage
[%s]\n", handlers->name);
+#ifdef PHP_WIN32
+ fflush(stderr);
+#endif
+ exit(255);
+ }
heap->storage = storage;
heap->block_size = block_size;
heap->compact_size = 0;
Modified: php/php-src/trunk/Zend/zend_alloc.c
===================================================================
--- php/php-src/trunk/Zend/zend_alloc.c 2011-02-07 10:17:14 UTC (rev 308089)
+++ php/php-src/trunk/Zend/zend_alloc.c 2011-02-07 10:25:34 UTC (rev 308090)
@@ -241,6 +241,10 @@
return NULL;
}
storage = (zend_mm_storage*)malloc(sizeof(zend_mm_storage));
+ if (storage == NULL) {
+ HeapDestroy(heap);
+ return NULL;
+ }
storage->data = (void*) heap;
return storage;
}
@@ -1088,7 +1092,13 @@
storage->handlers = handlers;
heap = malloc(sizeof(struct _zend_mm_heap));
-
+ if (heap == NULL) {
+ fprintf(stderr, "Cannot allocate heap for zend_mm storage
[%s]\n", handlers->name);
+#ifdef PHP_WIN32
+ fflush(stderr);
+#endif
+ exit(255);
+ }
heap->storage = storage;
heap->block_size = block_size;
heap->compact_size = 0;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php