Skip to content

Commit 1cf5445

Browse files
committed
Return false when allocations fail in _resizeConditionalAllocationBuffer (not yet in use)
1 parent 8b6bd96 commit 1cf5445

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

stdlib/public/SwiftShims/FoundationOverlayShims.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ static inline _Bool _resizeConditionalAllocationBuffer(_ConditionalAllocationBuf
4545
void *newMemory;
4646
if (buffer->onStack) {
4747
newMemory = malloc(amount);
48+
if (newMemory == NULL) { return false; }
4849
memcpy(newMemory, buffer->memory, buffer->capacity);
4950
buffer->onStack = false;
5051
} else {
5152
newMemory = realloc(buffer->memory, amount);
53+
if (newMemory == NULL) { return false; }
5254
}
5355
if (newMemory == NULL) { return false; }
5456
buffer->memory = newMemory;

0 commit comments

Comments
 (0)