Skip to content

Commit 5abf4f2

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Fixed incorrect tracked malloc deallocation
2 parents e14421c + 4553258 commit 5abf4f2

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
@@ -2432,6 +2432,13 @@ ZEND_API bool is_zend_ptr(const void *ptr)
24322432
{
24332433
#if ZEND_MM_CUSTOM
24342434
if (AG(mm_heap)->use_custom_heap) {
2435+
if (AG(mm_heap)->custom_heap.std._malloc == tracked_malloc) {
2436+
zend_ulong h = ((uintptr_t) ptr) >> ZEND_MM_ALIGNMENT_LOG2;
2437+
zval *size_zv = zend_hash_index_find(AG(mm_heap)->tracked_allocs, h);
2438+
if (size_zv) {
2439+
return 1;
2440+
}
2441+
}
24352442
return 0;
24362443
}
24372444
#endif

0 commit comments

Comments
 (0)