avoid-resource-leak-pg_dumpall.patch

application/octet-stream

Filename: avoid-resource-leak-pg_dumpall.patch
Type: application/octet-stream
Part: 0
Message: Avoid resource leak (src/bin/pg_dump/pg_dumpall.c)

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
src/bin/pg_dump/pg_dumpall.c 2 1
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 4ded902095..ce09be9a3e 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -1833,7 +1833,6 @@ dropDBs(PGconn *conn)
 	for (i = 0; i < PQntuples(res); i++)
 	{
 		char	   *dbname = PQgetvalue(res, i, 0);
-		PQExpBuffer delQry = createPQExpBuffer();
 
 		/*
 		 * Skip "postgres" and "template1"; dumpDatabases() will deal with
@@ -1844,6 +1843,8 @@ dropDBs(PGconn *conn)
 			strcmp(dbname, "template0") != 0 &&
 			strcmp(dbname, "postgres") != 0)
 		{
+			PQExpBuffer delQry = createPQExpBuffer();
+
 			if (archDumpFormat == archNull)
 			{
 				appendPQExpBuffer(delQry, "DROP DATABASE %s%s;\n",