Re: Fix some resources leaks (src/bin/pg_basebackup/pg_createsubscriber.c)

Поиск
Список
Период
Сортировка
От Euler Taveira
Тема Re: Fix some resources leaks (src/bin/pg_basebackup/pg_createsubscriber.c)
Дата
Msg-id 7c1ec392-bd03-40aa-8a2a-81969af2f1cd@app.fastmail.com
обсуждение исходный текст
Ответ на [MASSMAIL] Fix some resources leaks (src/bin/pg_basebackup/pg_createsubscriber.c)  (Ranier Vilela <ranier.vf@gmail.com>)
Ответы Re: Fix some resources leaks (src/bin/pg_basebackup/pg_createsubscriber.c)  (Ranier Vilela <ranier.vf@gmail.com>)
Re: Fix some resources leaks (src/bin/pg_basebackup/pg_createsubscriber.c)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Wed, Mar 27, 2024, at 8:50 PM, Ranier Vilela wrote:
Coverity has some reports in the new code
pg_createsubscriber.c
I think that Coverity is right.

It depends on your "right" definition. If your program execution is ephemeral
and the leak is just before exiting, do you think it's worth it?

1.
CID 1542682: (#1 of 1): Resource leak (RESOURCE_LEAK)
leaked_storage: Variable buf going out of scope leaks the storage it points to.

It will exit in the next instruction.

2.
CID 1542704: (#1 of 1): Resource leak (RESOURCE_LEAK)
leaked_storage: Variable conn going out of scope leaks the storage it points to.

The connect_database function whose exit_on_error is false is used in 2 routines:

* cleanup_objects_atexit: that's about to exit;
* drop_primary_replication_slot: that will execute a few routines before exiting.

3.
CID 1542691: (#1 of 1): Resource leak (RESOURCE_LEAK)
leaked_storage: Variable str going out of scope leaks the storage it points to.

It will exit in the next instruction.

Having said that, applying this patch is just a matter of style.


--
Euler Taveira

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

Предыдущее
От: Melanie Plageman
Дата:
Сообщение: Re: Combine Prune and Freeze records emitted by vacuum
Следующее
От: Richard Guo
Дата:
Сообщение: Re: Remove some redundant set_cheapest() calls