pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: In psql, avoid leaking a PGresult after a query is cancelled.
3+ messages / 1 participants
[nested] [flat]

* pgsql: In psql, avoid leaking a PGresult after a query is cancelled.
@ 2024-04-08 21:00 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2024-04-08 21:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

In psql, avoid leaking a PGresult after a query is cancelled.

After a query cancel, the tail end of ExecQueryAndProcessResults
took care to clear any not-yet-read PGresults; but it forgot about
the one it has already read.  There would only be such a result
when handling a multi-command string made with "\;", so that you'd
have to cancel an earlier command in such a string to reach the
bug at all.  Even then, there would only be leakage of a single
PGresult per cancel, so it's not surprising nobody noticed this.
But a leak is a leak.

Noted while re-reviewing 90f517821, but this is independent of that:
it dates to 7844c9918.  Back-patch to v15 where that came in.

Branch
------
master

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

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



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

* pgsql: In psql, avoid leaking a PGresult after a query is cancelled.
@ 2024-04-08 21:00 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2024-04-08 21:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

In psql, avoid leaking a PGresult after a query is cancelled.

After a query cancel, the tail end of ExecQueryAndProcessResults
took care to clear any not-yet-read PGresults; but it forgot about
the one it has already read.  There would only be such a result
when handling a multi-command string made with "\;", so that you'd
have to cancel an earlier command in such a string to reach the
bug at all.  Even then, there would only be leakage of a single
PGresult per cancel, so it's not surprising nobody noticed this.
But a leak is a leak.

Noted while re-reviewing 90f517821, but this is independent of that:
it dates to 7844c9918.  Back-patch to v15 where that came in.

Branch
------
REL_16_STABLE

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

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



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

* pgsql: In psql, avoid leaking a PGresult after a query is cancelled.
@ 2024-04-08 21:00 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2024-04-08 21:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

In psql, avoid leaking a PGresult after a query is cancelled.

After a query cancel, the tail end of ExecQueryAndProcessResults
took care to clear any not-yet-read PGresults; but it forgot about
the one it has already read.  There would only be such a result
when handling a multi-command string made with "\;", so that you'd
have to cancel an earlier command in such a string to reach the
bug at all.  Even then, there would only be leakage of a single
PGresult per cancel, so it's not surprising nobody noticed this.
But a leak is a leak.

Noted while re-reviewing 90f517821, but this is independent of that:
it dates to 7844c9918.  Back-patch to v15 where that came in.

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4f1d33d707fbdf38296ed8b262ae1ea3dcde2b18

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



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


end of thread, other threads:[~2024-04-08 21:00 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-04-08 21:00 pgsql: In psql, avoid leaking a PGresult after a query is cancelled. Tom Lane <tgl@sss.pgh.pa.us>
2024-04-08 21:00 pgsql: In psql, avoid leaking a PGresult after a query is cancelled. Tom Lane <tgl@sss.pgh.pa.us>
2024-04-08 21:00 pgsql: In psql, avoid leaking a PGresult after a query is cancelled. Tom Lane <tgl@sss.pgh.pa.us>

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