]> granicus.if.org Git - php/commitdiff
Check if realloc() succeeds or not. (Noticed by Andrey)
authorIlia Alshanetsky <iliaa@php.net>
Tue, 6 Jan 2004 22:44:40 +0000 (22:44 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 6 Jan 2004 22:44:40 +0000 (22:44 +0000)
Zend/zend_mm.c

index 04102720efeab527fe3def6cfe7cef488d6e41f5..0a9793e399b12cd0c5060589fac62b2331be24a9 100644 (file)
@@ -408,6 +408,9 @@ void *zend_mm_realloc(zend_mm_heap *heap, void *p, size_t size)
                /* segment size, size of block and size of guard block */
                realloc_to_size = ZEND_MM_ALIGNED_SEGMENT_SIZE+true_size+ZEND_MM_ALIGNED_HEADER_SIZE;
                segment = realloc(segment, realloc_to_size);
+               if (!segment) {
+                       return NULL;
+               }
 
                if (segment != segment_copy) {
                        if (heap->segments_list == segment_copy) {