From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Fix assorted new memory leaks in libpq. |
Date: | 2025-05-23 00:36:14 |
Message-ID: | E1uIGOT-000KHs-2r@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix assorted new memory leaks in libpq.
Valgrind'ing the postgres_fdw tests showed me that libpq was leaking
PGconn.be_cancel_key. It looks like freePGconn is expecting
pqDropServerData to release it ... but in a cancel connection
object, that doesn't happen.
Looking a little closer, I was dismayed to find that freePGconn
also missed freeing the pgservice, min_protocol_version,
max_protocol_version, sslkeylogfile, scram_client_key_binary,
and scram_server_key_binary strings. There's much less excuse
for those oversights. Worse, that's from five different commits
(a460251f0, 4b99fed75, 285613c60, 2da74d8d6, 761c79508),
some of them by extremely senior hackers.
Fortunately, all of these are new in v18, so we haven't
shipped any leaky versions of libpq.
While at it, reorder the operations in freePGconn to match the
order of the fields in struct PGconn. Some of those free's seem
to have been inserted with the aid of a dartboard.
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/b7ab88ddb1b9872cd997aea921df99eed8ac220b
Modified Files
--------------
src/interfaces/libpq/fe-connect.c | 44 +++++++++++++++++++++------------------
1 file changed, 24 insertions(+), 20 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2025-05-23 01:41:41 | pgsql: doc PG 18 relnotes: remove duplicate commit entry |
Previous Message | Melanie Plageman | 2025-05-22 21:18:02 | pgsql: Replace deprecated log_connections values in docs and tests |