Skip to content

Commit a95316f

Browse files
committed
Merge branch 'PHP-8.2'
* PHP-8.2: Fixed incorrect tracked malloc deallocation
2 parents 98768cf + 5abf4f2 commit a95316f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Zend/zend_alloc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2434,6 +2434,13 @@ ZEND_API bool is_zend_ptr(const void *ptr)
24342434
{
24352435
#if ZEND_MM_CUSTOM
24362436
if (AG(mm_heap)->use_custom_heap) {
2437+
if (AG(mm_heap)->custom_heap.std._malloc == tracked_malloc) {
2438+
zend_ulong h = ((uintptr_t) ptr) >> ZEND_MM_ALIGNMENT_LOG2;
2439+
zval *size_zv = zend_hash_index_find(AG(mm_heap)->tracked_allocs, h);
2440+
if (size_zv) {
2441+
return 1;
2442+
}
2443+
}
24372444
return 0;
24382445
}
24392446
#endif

0 commit comments

Comments
 (0)