Fix minor memory leak in connection string validation

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Fix minor memory leak in connection string validation
Дата
Msg-id 066a65233d3cb4ea27a9e0778d2f1d0dc764b222.camel@j-davis.com
обсуждение исходный текст
Ответы Re: Fix minor memory leak in connection string validation  (Nathan Bossart <nathandbossart@gmail.com>)
Список pgsql-hackers
Introduced in commit c3afe8cf5a.

Someone issuing repeated "CREATE SUBSCRIPTION" commands where the
connection has no password and must_have_password is true will leak
malloc'd memory in the error path. Minor issue in practice, because I
suspect that a user privileged enough to create a subscription could
cause bigger problems.

It makes me wonder if we should use the resowner mechanism to track
pointers to malloc'd memory. Then we could use a standard pattern for
these kinds of cases, and it would also catch more remote issues, like
if a pstrdup() fails in an error path (which can happen a few lines up
if the parse fails).

Patch attached; intended for 16 and 17.

Regards,
    Jeff Davis


Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pg_upgrade failing for 200+ million Large Objects
Следующее
От: Thomas Munro
Дата:
Сообщение: Re: cfbot is failing all tests on FreeBSD/Meson builds