pgsql: Fix incorrect "return NULL" in BumpAllocLarge().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix incorrect "return NULL" in BumpAllocLarge().
Date: 2025-05-11 00:22:51
Message-ID: E1uDuSw-0018th-23@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a05cf22e0540e55fb34e26e6e98a8a76b76d1cbd

Modified Files
--------------
src/backend/utils/mmgr/bump.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Álvaro Herrera 2025-05-11 13:16:07 pgsql: Sort includes in alphabetical order
Previous Message Noah Misch 2025-05-10 14:38:58 pgsql: Remove GLOBALTABLESPACE_OID assert for locked buffers.