From: Dmitry Stogov Date: Mon, 17 Sep 2018 17:20:13 +0000 (+0300) Subject: Allow switching back to Zend MM heap. X-Git-Tag: php-7.3.0RC2~25 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b25bc917ec8e59190c12e3fe87acc3ef4aa344a1;p=php Allow switching back to Zend MM heap. --- diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 302f9e7281..05992a7cdf 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -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 }