Skip to content

Commit 5cc2114

Browse files
committed
Fixes
1 parent 0904399 commit 5cc2114

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

Zend/zend_alloc.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,8 +1714,6 @@ static zend_never_inline void *zend_mm_realloc_huge(zend_mm_heap *heap, void *pt
17141714

17151715
static zend_always_inline void *zend_mm_realloc_heap(zend_mm_heap *heap, void *ptr, size_t size, bool use_copy_size, size_t copy_size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
17161716
{
1717-
printf("Reallocating %zu bytes at %p\n", size, ptr);
1718-
17191717
size_t page_offset;
17201718
size_t old_size;
17211719
size_t new_size;
@@ -1727,10 +1725,12 @@ static zend_always_inline void *zend_mm_realloc_heap(zend_mm_heap *heap, void *p
17271725
page_offset = ZEND_MM_ALIGNED_OFFSET(ptr, ZEND_MM_CHUNK_SIZE);
17281726
if (UNEXPECTED(page_offset == 0)) {
17291727
if (EXPECTED(ptr == NULL)) {
1730-
return _zend_mm_alloc(heap, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
1728+
ret = _zend_mm_alloc(heap, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
17311729
} else {
1732-
return zend_mm_realloc_huge(heap, ptr, size, copy_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
1730+
ret = zend_mm_realloc_huge(heap, ptr, size, copy_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
17331731
}
1732+
printf("Reallocated %zu bytes from %p to %p\n", size, ptr, ret);
1733+
return ret;
17341734
} else {
17351735
zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE);
17361736
ZEND_ASAN_UNPOISON_MEMORY_REGION(chunk, sizeof(zend_mm_chunk));
@@ -1801,6 +1801,7 @@ static zend_always_inline void *zend_mm_realloc_heap(zend_mm_heap *heap, void *p
18011801
dbg->orig_lineno = __zend_orig_lineno;
18021802
#endif
18031803
ZEND_ASAN_POISON_CHUNK_HEADER_NOT_HEAP(chunk, heap);
1804+
printf("Reallocated %zu bytes from %p to %p\n", size, ptr, ret);
18041805
return ret;
18051806
} while (0);
18061807

@@ -1819,6 +1820,7 @@ static zend_always_inline void *zend_mm_realloc_heap(zend_mm_heap *heap, void *p
18191820
dbg->orig_lineno = __zend_orig_lineno;
18201821
#endif
18211822
ZEND_ASAN_POISON_CHUNK_HEADER_NOT_HEAP(chunk, heap);
1823+
printf("Reallocated %zu bytes from %p to %p\n", size, ptr, ptr);
18221824
return ptr;
18231825
} else if (new_size < old_size) {
18241826
/* free tail pages */
@@ -1842,6 +1844,7 @@ static zend_always_inline void *zend_mm_realloc_heap(zend_mm_heap *heap, void *p
18421844
dbg->orig_lineno = __zend_orig_lineno;
18431845
#endif
18441846
ZEND_ASAN_POISON_CHUNK_HEADER_NOT_HEAP(chunk, heap);
1847+
printf("Reallocated %zu bytes from %p to %p\n", size, ptr, ptr);
18451848
return ptr;
18461849
} else /* if (new_size > old_size) */ {
18471850
int new_pages_count = (int)(new_size / ZEND_MM_PAGE_SIZE);
@@ -1871,6 +1874,7 @@ static zend_always_inline void *zend_mm_realloc_heap(zend_mm_heap *heap, void *p
18711874
dbg->orig_lineno = __zend_orig_lineno;
18721875
#endif
18731876
ZEND_ASAN_POISON_CHUNK_HEADER_NOT_HEAP(chunk, heap);
1877+
printf("Reallocated %zu bytes from %p to %p\n", size, ptr, ptr);
18741878
return ptr;
18751879
}
18761880
}
@@ -1883,7 +1887,9 @@ static zend_always_inline void *zend_mm_realloc_heap(zend_mm_heap *heap, void *p
18831887
}
18841888

18851889
copy_size = MIN(old_size, copy_size);
1886-
return zend_mm_realloc_slow(heap, ptr, size, copy_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
1890+
ret = zend_mm_realloc_slow(heap, ptr, size, copy_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
1891+
printf("Reallocated %zu bytes from %p to %p\n", size, ptr, ret);
1892+
return ret;
18871893
}
18881894

18891895
/*********************/

0 commit comments

Comments
 (0)