Re: Plug minor memleak in pg_dump

Поиск
Список
Период
Сортировка
От Ranier Vilela
Тема Re: Plug minor memleak in pg_dump
Дата
Msg-id CAEudQArrGb+PBKRozPFZbs6YxTO3ZmYMXPxY_0ZEtgXk9UEmNw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Plug minor memleak in pg_dump  (Michael Paquier <michael@paquier.xyz>)
Ответы Re: Plug minor memleak in pg_dump  (Ranier Vilela <ranier.vf@gmail.com>)
Re: Plug minor memleak in pg_dump  (Daniel Gustafsson <daniel@yesql.se>)
Список pgsql-hackers
Em qua., 9 de fev. de 2022 às 23:16, Michael Paquier <michael@paquier.xyz> escreveu:
On Wed, Feb 09, 2022 at 02:48:35PM -0300, Ranier Vilela wrote:
> IMO I think that still have troubles here.
>
> ReadStr can return NULL, so the fix can crash.

-           sscanf(tmp, "%u", &te->catalogId.tableoid);
-           free(tmp);
+           if (tmp)
+           {
+               sscanf(tmp, "%u", &te->catalogId.tableoid);
+               free(tmp);
+           }
+           else
+               te->catalogId.tableoid = InvalidOid;

This patch makes things worse, doesn't it? 
No.
 
Doesn't this localized
change mean that we expose ourselves more into *ignoring* TOC entries
if we mess up with this code in the future?
InvalidOid already used for "default".
If ReadStr fails and returns NULL, sscanf will crash.

Maybe in this case, better report to the user?
pg_log_warning?

regards,
Ranier Vilela

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

Предыдущее
От: Julien Rouhaud
Дата:
Сообщение: Re: Database-level collation version tracking
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Unnecessary call to resetPQExpBuffer in getIndexes