pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix incorrect "return NULL" in BumpAllocLarge().
Date: Sun, 11 May 2025 00:22:51 +0000
Message-ID: <E1uDuSw-0018tf-1z@gemulon.postgresql.org> (raw)

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
------
master

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

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



view thread (2+ messages)  latest in thread

Message-ID: <E1uDuSw-0018tf-1z@gemulon.postgresql.org>
Permalink:  ../E1uDuSw-0018tf-1z@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1uDuSw-0018tf-1z@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix incorrect "return NULL" in BumpAllocLarge().
  In-Reply-To: <E1uDuSw-0018tf-1z@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox