pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix minor memory leaks in pg_dump. 2+ messages / 1 participants [nested] [flat]
* pgsql: Fix minor memory leaks in pg_dump. @ 2021-10-24 16:39 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2021-10-24 16:39 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix minor memory leaks in pg_dump. I found these by running pg_dump under "valgrind --leak-check=full". The changes in flagInhIndexes() and getIndexes() replace allocation of an array of which we use only some elements by individual allocations of just the actually-needed objects. The previous coding wasted some memory, but more importantly it confused valgrind's leak tracking. collectComments() and collectSecLabels() remain major blots on the valgrind report, because they don't PQclear their query results, in order to avoid a lot of strdup's. That's a dubious tradeoff, but I'll leave it alone here; an upcoming patch will modify those functions enough to justify changing the tradeoff. Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/70bef494000e4dbbeca0f0a40347ca1747aea701 Modified Files -------------- src/bin/pg_dump/common.c | 42 ++++++++++++------------ src/bin/pg_dump/pg_backup_archiver.c | 2 ++ src/bin/pg_dump/pg_dump.c | 63 +++++++++++++++++++----------------- 3 files changed, 56 insertions(+), 51 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Fix minor memory leaks in pg_dump. @ 2025-02-12 21:07 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2025-02-12 21:07 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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. Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/fcd77a6873018c06a34761b7be0c0d1fd847fdd5 Modified Files -------------- src/bin/pg_dump/pg_dump.c | 3 +++ 1 file changed, 3 insertions(+) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2025-02-12 21:07 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-10-24 16:39 pgsql: Fix minor memory leaks in pg_dump. Tom Lane <tgl@sss.pgh.pa.us> 2025-02-12 21:07 pgsql: Fix minor memory leaks in pg_dump. Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox