pgsql: Silence leakage complaint about postgres_fdw's InitPgFdwOptions. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Silence leakage complaint about postgres_fdw's InitPgFdwOptions.
Date
Msg-id E1ufPFk-000j9L-0O@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Silence leakage complaint about postgres_fdw's InitPgFdwOptions.

Valgrind complains that the PQconninfoOption array returned by libpq
is leaked.  We apparently believed that we could suppress that warning
by storing that array's address in a static variable.  However, modern
C compilers are bright enough to optimize the static variable away.

We could escalate that arms race by making the variable global.
But on the whole it seems better to revise the code so that it
can free libpq's result properly.  The only thing that costs
us is copying the parameter-name keywords; which seems like a
pretty negligible cost in a function that runs at most once per
process.

Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Discussion: https://postgr.es/m/2976982.1748049023@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0f9d4d7c12dcebe951061763ca23ee3b6477e7ca

Modified Files
--------------
contrib/postgres_fdw/option.c | 33 ++++++++++++---------------------
1 file changed, 12 insertions(+), 21 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix dynahash's HASH_FIXED_SIZE ("isfixed") option.
Next
From: Tom Lane
Date:
Subject: pgsql: Add commit 73873805f to .git-blame-ignore-revs.