]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Silence leakage complaint about postgres_fdw's InitPgFdwOptions.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 25 Jul 2025 20:37:29 +0000 (16:37 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 25 Jul 2025 20:37:29 +0000 (16:37 -0400)
commit0f9d4d7c12dcebe951061763ca23ee3b6477e7ca
tree3696d0d57af5bf432cb2d9a75d2567dd000b278e
parent73873805fb3627cb23937c750fa83ffd8f16fc6c
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
contrib/postgres_fdw/option.c