Fix a couple of memory leaks in pg_restore.c
authorAndrew Dunstan <andrew@dunslane.net>
Sun, 6 Apr 2025 13:08:02 +0000 (09:08 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Sun, 6 Apr 2025 13:09:25 +0000 (09:09 -0400)
per complaint from Coverity.

src/bin/pg_dump/pg_restore.c

index db8356405d94cab1ef4f316fc1ff031fbf59091c..c42e34b8a40b079adac9473903e130bf1f04038f 100644 (file)
@@ -991,6 +991,8 @@ get_dbnames_list_to_restore(PGconn *conn,
                break;
        }
 
+       destroyPQExpBuffer(db_lit);
+
        /*
         * Mark db to be skipped or increment the counter of dbs to be
         * restored
@@ -1006,6 +1008,8 @@ get_dbnames_list_to_restore(PGconn *conn,
        }
    }
 
+   destroyPQExpBuffer(query);
+
    return count_db;
 }