pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: psql: Fix psql slash option leaks
Date: Wed, 19 Aug 2026 03:40:06 +0000
Message-ID: <E1wwX9p-000000019SA-09zN@gemulon.postgresql.org> (raw)

psql: Fix psql slash option leaks

psql_scan_slash_option() returns a malloc'd string, but \getresults,
\gset in pipeline mode, \restrict, and \unrestrict did not free it
after consuming or copying the value.

Free these option strings after use.

Backpatch to all supported versions. In v17 and older, only \restrict
and \unrestrict are affected, so those branches need only that part of
the fix.

Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwEh3R3=1tx_a5=fTDJ+ycuwxWMEn6bG_Yt4B5P+hE7AVw@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_19_STABLE

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

Modified Files
--------------
src/bin/psql/command.c | 8 ++++++++
1 file changed, 8 insertions(+)



view thread (7+ messages)  latest in thread

Message-ID: <E1wwX9p-000000019SA-09zN@gemulon.postgresql.org>
Permalink:  ../E1wwX9p-000000019SA-09zN@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wwX9p-000000019SA-09zN@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: fujii@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: psql: Fix psql slash option leaks
  In-Reply-To: <E1wwX9p-000000019SA-09zN@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