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: pg_upgrade: Fix inconsistency in memory freeing
Date: Fri, 28 Feb 2025 01:16:34 +0000
Message-ID: <E1tnozS-000426-37@gemulon.postgresql.org> (raw)

pg_upgrade: Fix inconsistency in memory freeing

The function in charge of freeing the memory from a result created by
PQescapeIdentifier() has to be PQfreemem(), to ensure that both
allocation and free come from libpq.

One spot in pg_upgrade was not respecting that for pg_database's
datlocale (daticulocale in v16) when the collation provider is libc (aka
datlocale/daticulocale is NULL) with an allocation done using
pg_strdup() and a free with PQfreemem().  The code is changed to always
use PQescapeLiteral() when processing the input.

Oversight in 9637badd9f92.  This commit is similar to 48e4ae9a0707 and
5b94e2753439.

Author: Michael Paquier <michael@paquier.xyz>
Co-authored-by: Ranier Vilela <ranier.vf@gmail.com>
Discussion: https://postgr.es/m/Z601RQxTmIUohdkV@paquier.xyz
Backpatch-through: 16

Branch
------
REL_17_STABLE

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

Modified Files
--------------
src/bin/pg_upgrade/pg_upgrade.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)



view thread (10+ messages)  latest in thread

Message-ID: <E1tnozS-000426-37@gemulon.postgresql.org>
Permalink:  ../E1tnozS-000426-37@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1tnozS-000426-37@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: pg_upgrade: Fix inconsistency in memory freeing
  In-Reply-To: <E1tnozS-000426-37@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