Re: BUG #18845: DEREF_OF_NULL.RET guc_malloc possibly returns NULL
От | Daniel Gustafsson |
---|---|
Тема | Re: BUG #18845: DEREF_OF_NULL.RET guc_malloc possibly returns NULL |
Дата | |
Msg-id | A664B6DF-7D34-4004-AC89-66B1517B3301@yesql.se обсуждение исходный текст |
Ответ на | BUG #18845: DEREF_OF_NULL.RET guc_malloc possibly returns NULL (PG Bug reporting form <noreply@postgresql.org>) |
Ответы |
Re: BUG #18845: DEREF_OF_NULL.RET guc_malloc possibly returns NULL
|
Список | pgsql-bugs |
> On 14 Mar 2025, at 08:58, PG Bug reporting form <noreply@postgresql.org> wrote: > > 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)); 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
В списке pgsql-bugs по дате отправления: