BUG #18845: DEREF_OF_NULL.RET guc_malloc possibly returns NULL

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: pm91(dot)arapov(at)gmail(dot)com
Subject: BUG #18845: DEREF_OF_NULL.RET guc_malloc possibly returns NULL
Date: 2025-03-14 07:58:45
Message-ID: 18845-582c6e10247377ec@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 18845
Logged by: Nikita
Email address: pm91(dot)arapov(at)gmail(dot)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;

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2025-03-14 08:01:15 BUG #18846: Incorrect Filtering Behavior with FULL OUTER JOIN and WHERE Condition
Previous Message Tom Lane 2025-03-14 03:46:10 Re: BUG #18839: ARMv7 builds fail due to missing __crc32cw and similar