pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix minor memory leaks in pg_dump.
Date: Sun, 24 Oct 2021 16:39:04 +0000
Message-ID: <E1megWW-0001DE-Fx@gemulon.postgresql.org> (raw)

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(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1megWW-0001DE-Fx@gemulon.postgresql.org>
Permalink:  ../E1megWW-0001DE-Fx@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1megWW-0001DE-Fx@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix minor memory leaks in pg_dump.
  In-Reply-To: <E1megWW-0001DE-Fx@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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