Re: Fix some resources leaks (src/bin/pg_basebackup/pg_createsubscriber.c)
Euler Taveira <euler@eulerto.com>
From: "Euler Taveira" <euler@eulerto.com>
To: "ranier.vf@gmail.com" <ranier.vf@gmail.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-03-28T02:07:44Z
Lists: 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 EDB https://www.enterprisedb.com/
Commits
-
Fix assorted resource leaks in new pg_createsubscriber code.
- 91cbb4b492cb 17.0 landed