From b25bc917ec8e59190c12e3fe87acc3ef4aa344a1 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 17 Sep 2018 20:20:13 +0300 Subject: [PATCH] Allow switching back to Zend MM heap. --- Zend/zend_alloc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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 } -- 2.40.0