Skip to content

Commit 9a98904

Browse files
committed
Adjust zend_mm_refresh_key_child()
1 parent 5e7fb2c commit 9a98904

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

Zend/zend_alloc.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,19 +2136,21 @@ ZEND_API void zend_mm_refresh_key_child(zend_mm_heap *heap)
21362136
zend_mm_init_key(heap);
21372137

21382138
/* Update shadow pointers with new key */
2139-
for (int i = 0; i < ZEND_MM_BINS; i++) {
2140-
zend_mm_free_slot *slot = heap->free_slot[i];
2141-
if (!slot) {
2142-
continue;
2143-
}
2144-
zend_mm_free_slot *next;
2145-
while ((next = slot->next_free_slot)) {
2146-
zend_mm_free_slot *shadow = ZEND_MM_FREE_SLOT_PTR_SHADOW(slot, i);
2147-
if (UNEXPECTED(next != zend_mm_decode_free_slot_key(old_key, shadow))) {
2148-
zend_mm_panic("zend_mm_heap corrupted");
2139+
for (int i = 0; i < ZEND_MM_ZONES; i++) {
2140+
for (int j = 0; j < ZEND_MM_BINS; j++) {
2141+
zend_mm_free_slot *slot = ZEND_MM_ZONE_FREE_SLOT(heap, i)[j];
2142+
if (!slot) {
2143+
continue;
2144+
}
2145+
zend_mm_free_slot *next;
2146+
while ((next = slot->next_free_slot)) {
2147+
zend_mm_free_slot *shadow = ZEND_MM_FREE_SLOT_PTR_SHADOW(slot, j);
2148+
if (UNEXPECTED(next != zend_mm_decode_free_slot_key(old_key, shadow))) {
2149+
zend_mm_panic("zend_mm_heap corrupted");
2150+
}
2151+
zend_mm_set_next_free_slot(heap, j, slot, next);
2152+
slot = next;
21492153
}
2150-
zend_mm_set_next_free_slot(heap, i, slot, next);
2151-
slot = next;
21522154
}
21532155
}
21542156
#endif

0 commit comments

Comments
 (0)