pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix some inconsistencies with memory freeing in pg_createsubscri
Date: Wed, 12 Feb 2025 08:12:06 +0000
Message-ID: <E1ti7qo-006hia-BU@gemulon.postgresql.org> (raw)

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(-)



view thread (2+ messages)

Message-ID: <E1ti7qo-006hia-BU@gemulon.postgresql.org>
Permalink:  ../E1ti7qo-006hia-BU@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ti7qo-006hia-BU@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix some inconsistencies with memory freeing in pg_createsubscri
  In-Reply-To: <E1ti7qo-006hia-BU@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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