summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2011-02-07 10:25:34 +0000
committerPierre Joye <pajoye@php.net>2011-02-07 10:25:34 +0000
commit44b9942ef39bde2772d06108529b430a2d0c137c (patch)
treecd7783d4c5815ce9bd78596014ed181de71c72d1
parent555e42fb5a97744a0c8e61593561a06ac30f192e (diff)
downloadphp-git-44b9942ef39bde2772d06108529b430a2d0c137c.tar.gz
- null deref fix
-rw-r--r--Zend/zend_alloc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index ac8b235df2..88944b45a2 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -241,6 +241,10 @@ static zend_mm_storage* zend_mm_mem_win32_init(void *params)
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 @@ ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_mem_handlers *handlers,
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;