pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: pm91.arapov@gmail.com
Subject: BUG #18845: DEREF_OF_NULL.RET guc_malloc possibly returns NULL
Date: Fri, 14 Mar 2025 07:58:45 +0000
Message-ID: <18845-582c6e10247377ec@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      18845
Logged by:          Nikita
Email address:      pm91.arapov@gmail.com
PostgreSQL version: 16.6
Operating system:   ubuntu 20.04
Description:        

guc_malloc possibly returns NULL, if no memory
I suggest the following patch fixing this issue

diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
--- a/src/backend/commands/user.c	(revision
a49ac80219c6f28c3cf3973f797de637329952da)
+++ b/src/backend/commands/user.c	(date 1740386879158)
@@ -2553,7 +2553,7 @@
 	pfree(rawstring);
 	list_free(elemlist);
 
-	result = (unsigned *) guc_malloc(LOG, sizeof(unsigned));
+	result = (unsigned *) guc_malloc(FATAL, sizeof(unsigned));
 	*result = options;
 	*extra = result;



view thread (10+ messages)  latest in thread

Message-ID: <18845-582c6e10247377ec@postgresql.org>
Permalink:  ../18845-582c6e10247377ec@postgresql.org/
Also on:    postgresql.org/message-id/18845-582c6e10247377ec@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-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, pm91.arapov@gmail.com
  Subject: Re: BUG #18845: DEREF_OF_NULL.RET guc_malloc possibly returns NULL
  In-Reply-To: <18845-582c6e10247377ec@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