summaryrefslogtreecommitdiff
path: root/Zend/zend_alloc.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-06-28 09:13:45 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-06-28 09:13:45 +0200
commit70fa4715a4209049769b8a62687f15e403183120 (patch)
treedc2492935873bd9b7a3b1e540a7e467572076b12 /Zend/zend_alloc.c
parent27f1f3ed1a040a7f20bd9bb16af7bf219f4df97f (diff)
downloadphp-git-70fa4715a4209049769b8a62687f15e403183120.tar.gz
Fix custom heap free
This seems to be designed around the use-case where the custom allocator is a wrapper around ZMM.
Diffstat (limited to 'Zend/zend_alloc.c')
-rw-r--r--Zend/zend_alloc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index 8bf37bc5fd..618a66a9ea 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -2203,11 +2203,17 @@ void zend_mm_shutdown(zend_mm_heap *heap, int full, int silent)
if (full) {
zend_hash_destroy(heap->tracked_allocs);
free(heap->tracked_allocs);
+ /* Make sure the heap free below does not use tracked_free(). */
+ heap->custom_heap.std._free = free;
}
}
if (full) {
- free(heap);
+ if (ZEND_DEBUG && heap->use_custom_heap == ZEND_MM_CUSTOM_HEAP_DEBUG) {
+ heap->custom_heap.debug._free(heap ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC);
+ } else {
+ heap->custom_heap.std._free(heap);
+ }
}
return;
}