pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix some inconsistencies with memory freeing in pg_createsubscri
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix some inconsistencies with memory freeing in pg_createsubscri
@ 2025-02-12 08:12 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2025-02-12 08:12 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix some inconsistencies with memory freeing in pg_createsubscriber

The correct function documented to free the memory allocated for the
result returned by PQescapeIdentifier() and PQescapeLiteral() is
PQfreemem().  pg_createsubscriber.c relied on pg_free() instead, which
is not incorrect as both do a free() internally, but inconsistent with
the documentation.

While on it, this commit fixes a small memory leak introduced by
4867f8a555ce, as the code of pg_createsubscriber makes this effort.

Author: Ranier Vilela
Reviewed-by: Euler Taveira
Discussion: https://postgr.es/m/CAEudQAp=AW5dJXrGLbC_aZg_9nOo=42W7uLDRONFQE-gcgnkgQ@mail.gmail.com
Backpatch-through: 17

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5b94e2753439b699b78aacbb53e89bf0e814becc

Modified Files
--------------
src/bin/pg_basebackup/pg_createsubscriber.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix some inconsistencies with memory freeing in pg_createsubscri
@ 2025-02-12 08:12 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2025-02-12 08:12 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix some inconsistencies with memory freeing in pg_createsubscriber

The correct function documented to free the memory allocated for the
result returned by PQescapeIdentifier() and PQescapeLiteral() is
PQfreemem().  pg_createsubscriber.c relied on pg_free() instead, which
is not incorrect as both do a free() internally, but inconsistent with
the documentation.

While on it, this commit fixes a small memory leak introduced by
4867f8a555ce, as the code of pg_createsubscriber makes this effort.

Author: Ranier Vilela
Reviewed-by: Euler Taveira
Discussion: https://postgr.es/m/CAEudQAp=AW5dJXrGLbC_aZg_9nOo=42W7uLDRONFQE-gcgnkgQ@mail.gmail.com
Backpatch-through: 17

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ff6d9cfcb17e48c313aefe8fc65cdaeacd8766bf

Modified Files
--------------
src/bin/pg_basebackup/pg_createsubscriber.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-02-12 08:12 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-02-12 08:12 pgsql: Fix some inconsistencies with memory freeing in pg_createsubscri Michael Paquier <michael@paquier.xyz>
2025-02-12 08:12 pgsql: Fix some inconsistencies with memory freeing in pg_createsubscri Michael Paquier <michael@paquier.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox