mirror of
https://github.com/postgres/postgres.git
synced 2025-05-15 00:02:24 -04:00
Fix incorrect "return NULL" in BumpAllocLarge().
This must be "return MemoryContextAllocationFailure(context, size, flags)" instead. The effect of this oversight is that if we got a malloc failure right here, the code would act as though MCXT_ALLOC_NO_OOM had been specified, whether it was or not. That would likely lead to a null-pointer-dereference crash at the unsuspecting call site. Noted while messing with a patch to improve our Valgrind leak detection support. Back-patch to v17 where this code came in.
This commit is contained in:
parent
3007fee7f2
commit
a05cf22e05
@ -316,7 +316,7 @@ BumpAllocLarge(MemoryContext context, Size size, int flags)
|
|||||||
|
|
||||||
block = (BumpBlock *) malloc(blksize);
|
block = (BumpBlock *) malloc(blksize);
|
||||||
if (block == NULL)
|
if (block == NULL)
|
||||||
return NULL;
|
return MemoryContextAllocationFailure(context, size, flags);
|
||||||
|
|
||||||
context->mem_allocated += blksize;
|
context->mem_allocated += blksize;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user