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 small memory leak in get_dbname_oid_list_from_mfile().
Date: Sun, 15 Mar 2026 19:24:10 +0000
Message-ID: <E1w1r4L-000KBa-1I@gemulon.postgresql.org> (raw)

Fix small memory leak in get_dbname_oid_list_from_mfile().

Coverity complained that this function leaked the dumpdirpath string,
which it did.  But we don't need to make a copy at all, because
there's not really any point in trimming trailing slashes from the
directory name here.  If that were needed, the initial
file_exists_in_directory() test would have failed, since it doesn't
bother with that (and neither does anyplace else in this file).
Moreover, if we did want that, reimplementing canonicalize_path()
poorly is not the way to proceed.  Arguably, all of this code should
be reexamined with an eye to using src/port/path.c's facilities, but
for today I'll settle for getting rid of the memory leak.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/bb53b8d359d33f10b6274be743c42f6e8ecfbb84

Modified Files
--------------
src/bin/pg_dump/pg_restore.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)



view thread (4+ messages)  latest in thread

Message-ID: <E1w1r4L-000KBa-1I@gemulon.postgresql.org>
Permalink:  ../E1w1r4L-000KBa-1I@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1w1r4L-000KBa-1I@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 small memory leak in get_dbname_oid_list_from_mfile().
  In-Reply-To: <E1w1r4L-000KBa-1I@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