ios/kernel: IOS_HeapRealloc allocates a new block if ptr is null

This commit is contained in:
GaryOderNichts 2023-10-20 12:23:04 +02:00 committed by James
parent dd0b1be358
commit d985cc8b2b

View file

@ -438,6 +438,11 @@ IOS_HeapRealloc(HeapId heapId,
return nullptr;
}
// Allocate a new block if ptr is null
if (!ptr) {
return IOS_HeapAllocAligned(heapId, size, HeapAllocAlignAlign);
}
if (!heapContainsPtr(heap, ptr)) {
heap->errorCountExpandInvalidBlock++;
return nullptr;