]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix small memory leak in get_dbname_oid_list_from_mfile().
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 15 Mar 2026 19:24:04 +0000 (15:24 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 15 Mar 2026 19:24:04 +0000 (15:24 -0400)
commitbb53b8d359d33f10b6274be743c42f6e8ecfbb84
treec606df014483d4098c44e37bf6f82ccca8b02d7b
parenta793677e57bc27c674cb94b230164b2c28f4cbae
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.
src/bin/pg_dump/pg_restore.c