| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix small memory leak in get_dbname_oid_list_from_mfile(). |
| Date: | 2026-03-15 19:24:10 |
| Message-ID: | E1w1r4L-000KBa-1I@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2026-03-15 20:52:09 | Re: pgsql: Make typeof and typeof_unqual fallback definitions work on C++11 |
| Previous Message | Tom Lane | 2026-03-15 18:05:06 | Re: pgsql: Make typeof and typeof_unqual fallback definitions work on C++11 |