summaryrefslogtreecommitdiff
path: root/Zend/zend_alloc.c
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
commita0a603d16b7b6b1a7d2b05effae89b1e11c7e67e (patch)
treeafa7148de3fd2804510cc069e5315f54375d6fd5 /Zend/zend_alloc.c
parent312235cdacb896e235bb68b582ddc45f56f2b818 (diff)
downloadphp-git-a0a603d16b7b6b1a7d2b05effae89b1e11c7e67e.tar.gz
- null deref fix
Diffstat (limited to 'Zend/zend_alloc.c')
-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 a8d72de776..4509a2b5f2 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;
}
@@ -1088,7 +1092,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;