Re: BUG #18845: DEREF_OF_NULL.RET guc_malloc possibly returns NULL

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #18845: DEREF_OF_NULL.RET guc_malloc possibly returns NULL
Дата
Msg-id 3791436.1742158193@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #18845: DEREF_OF_NULL.RET guc_malloc possibly returns NULL  (Daniel Gustafsson <daniel@yesql.se>)
Ответы Re: BUG #18845: DEREF_OF_NULL.RET guc_malloc possibly returns NULL
Список pgsql-bugs
Daniel Gustafsson <daniel@yesql.se> writes:
> Those are all good points, I initially didn't think we should touch the
> PGC_POSTMASTER cases but you are correct that avoiding back copy pastes to
> happen is a Good Thing. The attached has all these fixes added.

I think your fix in check_debug_io_direct is wrong:

-    *extra = guc_malloc(ERROR, sizeof(int));
+    *extra = guc_malloc(LOG, sizeof(int));
+    if (!*extra)
+    {
+        pfree(rawstring);
+        list_free(elemlist);
+        return false;
+    }

It looks to me like rawstring and elemlist were already freed,
so "return false" ought to be sufficient.

Also, in init_custom_variable maybe it'd be worth a comment,
along the lines of

-    gen = (struct config_generic *) guc_malloc(ERROR, sz);
+    /* As above, OOM is fatal */
+    gen = (struct config_generic *) guc_malloc(FATAL, sz);

Otherwise LGTM.

            regards, tom lane



В списке pgsql-bugs по дате отправления: