Thread: pgsql: ecpg: clean up some other assorted memory leaks.

pgsql: ecpg: clean up some other assorted memory leaks.

From
Tom Lane
Date:
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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2b41de4a5b429c53ae5fb5ff92b2e9822fd2cd9a

Modified Files
--------------
src/interfaces/ecpg/preproc/descriptor.c | 14 +++++++---
src/interfaces/ecpg/preproc/ecpg.addons  | 47 ++++++++++++--------------------
src/interfaces/ecpg/preproc/ecpg.c       |  2 +-
src/interfaces/ecpg/preproc/ecpg.header  | 17 +++++++++++-
src/interfaces/ecpg/preproc/ecpg.trailer | 31 ++++++++++++---------
src/interfaces/ecpg/preproc/output.c     |  3 +-
src/interfaces/ecpg/preproc/variable.c   | 25 +++++++++++++++--
7 files changed, 86 insertions(+), 53 deletions(-)