Re: [PATCH] FIx resource leaks (pg_resetwal.c)

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: [PATCH] FIx resource leaks (pg_resetwal.c)
Дата
Msg-id 20200423182703.g6gqxzzdoyib3jjk@alap3.anarazel.de
обсуждение исходный текст
Ответ на [PATCH] FIx resource leaks (pg_resetwal.c)  (Ranier Vilela <ranier.vf@gmail.com>)
Ответы Re: [PATCH] FIx resource leaks (pg_resetwal.c)
Список pgsql-hackers
Hi,

On 2020-04-23 15:20:59 -0300, Ranier Vilela wrote:
> Per Coverity.
> 
> read_controlfile alloc memory with pg_malloc and fail in releasing the
> memory.

Seriously, this is getting really ridiculous. You're posting badly
vetted, often nearly verbatim, coverity reports. Many of them are
obvious false positives. This is just producing noise.

Please stop.


> diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c
> index 233441837f..673ab0204c 100644
> --- a/src/bin/pg_resetwal/pg_resetwal.c
> +++ b/src/bin/pg_resetwal/pg_resetwal.c
> @@ -608,6 +608,7 @@ read_controlfile(void)
>      len = read(fd, buffer, PG_CONTROL_FILE_SIZE);
>      if (len < 0)
>      {
> +        pg_free(buffer);        
>          pg_log_error("could not read file \"%s\": %m", XLOG_CONTROL_FILE);
>          exit(1);
>      }

There's an exit() two lines later, this is obviously not necessary.

Greetings,

Andres Freund



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

Предыдущее
От: Ranier Vilela
Дата:
Сообщение: [PATCH] FIx resource leaks (pg_resetwal.c)
Следующее
От: Ranier Vilela
Дата:
Сообщение: Re: [PATCH] FIx resource leaks (pg_resetwal.c)