Skip to content

Commit 4553258

Browse files
committedAug 1, 2023
Fixed incorrect tracked malloc deallocation
Fixes ext/ffi/tests/list.phpt failure
1 parent e61dbe5 commit 4553258

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
 

‎Zend/zend_alloc.c

+7
Original file line numberDiff line numberDiff line change
@@ -2412,6 +2412,13 @@ ZEND_API bool is_zend_ptr(const void *ptr)
24122412
{
24132413
#if ZEND_MM_CUSTOM
24142414
if (AG(mm_heap)->use_custom_heap) {
2415+
if (AG(mm_heap)->custom_heap.std._malloc == tracked_malloc) {
2416+
zend_ulong h = ((uintptr_t) ptr) >> ZEND_MM_ALIGNMENT_LOG2;
2417+
zval *size_zv = zend_hash_index_find(AG(mm_heap)->tracked_allocs, h);
2418+
if (size_zv) {
2419+
return 1;
2420+
}
2421+
}
24152422
return 0;
24162423
}
24172424
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.