From: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
---|---|
To: | pm91(dot)arapov(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #18845: DEREF_OF_NULL.RET guc_malloc possibly returns NULL |
Date: | 2025-03-14 13:50:46 |
Message-ID: | A664B6DF-7D34-4004-AC89-66B1517B3301@yesql.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
> On 14 Mar 2025, at 08:58, PG Bug reporting form <noreply(at)postgresql(dot)org> wrote:
>
> 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));
Why would we want FATAL here? Wouldn't it be better to return false like how
other check_ functions already do?
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -2566,6 +2566,8 @@ check_createrole_self_grant(char **newval, void **extra, GucSource source)
list_free(elemlist);
result = (unsigned *) guc_malloc(LOG, sizeof(unsigned));
+ if (!result)
+ return false;
*result = options;
*extra = result;
--
Daniel Gustafsson
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2025-03-14 13:50:57 | BUG #18847: Different Query Results with and without a Primary Key Constraint |
Previous Message | David G. Johnston | 2025-03-14 13:48:35 | Re: BUG #18846: Incorrect Filtering Behavior with FULL OUTER JOIN and WHERE Condition |