ecpg: clean up some other assorted memory leaks.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 27 Nov 2024 17:50:15 +0000 (12:50 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 27 Nov 2024 17:50:23 +0000 (12:50 -0500)
commit2b41de4a5b429c53ae5fb5ff92b2e9822fd2cd9a
treed3f053cbe5772addc7c4f4663e2cdfaee30bf5e2
parent85312d95e959bae16c5d0bbf79ae74bcd7fec1a9
ecpg: clean up some other assorted memory leaks.

Avoid leaking the prior value when updating the "connection"
state variable.

Ditto for ECPGstruct_sizeof.  (It seems like this one ought to
be statement-local, but testing says it isn't, and I didn't
feel like diving deeper.)

The actual_type[] entries are statement-local, though, so
no need to mm_strdup() strings stored in them.

Likewise, sqlda variables are statement-local, so we can
loc_alloc them.

Also clean up sloppiness around management of the argsinsert and
argsresult lists.

progname changes are strictly to prevent valgrind from complaining
about leaked allocations.

With this, valgrind reports zero leakage in the ecpg preprocessor
for all of our ecpg regression test cases.

Discussion: https://postgr.es/m/2011420.1713493114@sss.pgh.pa.us
src/interfaces/ecpg/preproc/descriptor.c
src/interfaces/ecpg/preproc/ecpg.addons
src/interfaces/ecpg/preproc/ecpg.c
src/interfaces/ecpg/preproc/ecpg.header
src/interfaces/ecpg/preproc/ecpg.trailer
src/interfaces/ecpg/preproc/output.c
src/interfaces/ecpg/preproc/variable.c