Small memory fixes for pg_createsubcriber
Ranier Vilela <ranier.vf@gmail.com>
From: Ranier Vilela <ranier.vf@gmail.com>
To: Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2025-02-10T16:31:20Z
Lists: pgsql-hackers
Attachments
- fix-resource-leak-and-api-misuse-pg_createsubcriber.patch (application/octet-stream) patch
Hi. Per Coverity. Coverity has some reports about pg_createsubcriber. CID 1591322: (#1 of 1): Resource leak (RESOURCE_LEAK) 10. leaked_storage: Variable dbname going out of scope leaks the storage it points to. Additionally there are several calls that are out of the ordinary, according to the Postgres API. According to the documentation: libpq-exec <https://www.postgresql.org/docs/current/libpq-exec.html> The correct function to free memory when using PQescapeLiteral and PQescapeIdentifier would be PQfreemem. Trivial fixes attached. best regards, Ranier Vilela
Commits
-
pg_upgrade: Fix inconsistency in memory freeing
- 9ca2145b00fb 16.9 landed
- ee78823ff5f6 17.5 landed
- 2a083ab807db 18.0 landed
-
pg_amcheck: Fix inconsistency in memory freeing
- 35a591a0486f 14.18 landed
- ec741d48036a 15.13 landed
- 816149dc6bf9 16.9 landed
- f903d4da9276 17.5 landed
- 48e4ae9a0707 18.0 landed
-
Fix some inconsistencies with memory freeing in pg_createsubscriber
- ff6d9cfcb17e 17.4 landed
- 5b94e2753439 18.0 landed
-
Drop pre-existing subscriptions from the converted subscriber.
- 4867f8a555ce 18.0 cited