diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2025-02-12 15:46:31 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2025-02-12 15:46:31 -0500 |
commit | fcd77a6873018c06a34761b7be0c0d1fd847fdd5 (patch) | |
tree | cd4d42334c85c33c8be000cd1300e098210a79f9 | |
parent | c45963c5d5cc0a3b8739ba158f781452a3fd89c5 (diff) | |
download | postgresql-fcd77a6873018c06a34761b7be0c0d1fd847fdd5.tar.gz postgresql-fcd77a6873018c06a34761b7be0c0d1fd847fdd5.zip |
Fix minor memory leaks in pg_dump.
Coverity reported the two oversights in getPublicationTables.
Valgrind found the one in determineNotNullFlags.
The mistakes in getPublicationTables seem too minor to be worth
back-patching. determineNotNullFlags could be run enough times
to matter, but that code is new in v18. So, no back-patch.
-rw-r--r-- | src/bin/pg_dump/pg_dump.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index ca15b40939c..30dfda8c3ff 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -4682,6 +4682,8 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables) appendPQExpBufferStr(attribs, fmtId(attnames[k])); } pubrinfo[j].pubrattrs = attribs->data; + free(attribs); /* but not attribs->data */ + free(attnames); } else pubrinfo[j].pubrattrs = NULL; @@ -9424,6 +9426,7 @@ determineNotNullFlags(Archive *fout, PGresult *res, int r, tbinfo->notnull_constrs[j] = pstrdup(PQgetvalue(res, r, i_notnull_name)); } + free(default_name); } } } |