From 600402d986984ec36fc0b5a375f35eae4a266558 Mon Sep 17 00:00:00 2001 From: fishmore <37470985+bigboysun@users.noreply.github.com> Date: Wed, 7 Apr 2021 16:30:55 +0800 Subject: [PATCH] Update zend_alloc.c Don't free main thunk. It will crash. --- Zend/zend_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 5458e7acf6c..f5fbee676db 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -1099,7 +1099,7 @@ static zend_always_inline void zend_mm_free_pages_ex(zend_mm_heap *heap, zend_mm /* this setting may be not accurate */ chunk->free_tail = page_num; } - if (free_chunk && chunk->free_pages == ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE) { + if (free_chunk && chunk != heap->main_chunk && chunk->free_pages == ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE) { zend_mm_delete_chunk(heap, chunk); } }