]> granicus.if.org Git - php/commitdiff
Allow switching back to Zend MM heap.
authorDmitry Stogov <dmitry@zend.com>
Mon, 17 Sep 2018 17:20:13 +0000 (20:20 +0300)
committerDmitry Stogov <dmitry@zend.com>
Mon, 17 Sep 2018 17:20:13 +0000 (20:20 +0300)
Zend/zend_alloc.c

index 302f9e728154e6bee645bad1f5b4eb2829f16287..05992a7cdf998112672bc07df7c37e07608f302d 100644 (file)
@@ -2748,10 +2748,14 @@ ZEND_API void zend_mm_set_custom_handlers(zend_mm_heap *heap,
 #if ZEND_MM_CUSTOM
        zend_mm_heap *_heap = (zend_mm_heap*)heap;
 
-       _heap->use_custom_heap = ZEND_MM_CUSTOM_HEAP_STD;
-       _heap->custom_heap.std._malloc = _malloc;
-       _heap->custom_heap.std._free = _free;
-       _heap->custom_heap.std._realloc = _realloc;
+       if (!_malloc && !_free && !_realloc) {
+               _heap->use_custom_heap = ZEND_MM_CUSTOM_HEAP_NONE;
+       } else {
+               _heap->use_custom_heap = ZEND_MM_CUSTOM_HEAP_STD;
+               _heap->custom_heap.std._malloc = _malloc;
+               _heap->custom_heap.std._free = _free;
+               _heap->custom_heap.std._realloc = _realloc;
+       }
 #endif
 }