Skip to content

Commit a8f87d5

Browse files
Fix query result leak during binary upgrade
9a974cb moved the query in binary_upgrade_set_pg_class_oids to the outer level, but left the PQclear and query buffer destruction in the is_index conditional. 353708e fixed the leak of the query buffer but left the PGresult leak. This moves clearing the result to the outer level ensuring that it will be called. Reviewed-by: Tom Lane <[email protected]> Discussion: https://postgr.es/m/[email protected] Backpatch-through: v15
1 parent 98b4f53 commit a8f87d5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5479,8 +5479,6 @@ binary_upgrade_set_pg_class_oids(Archive *fout,
54795479
"SELECT pg_catalog.binary_upgrade_set_next_index_relfilenode('%u'::pg_catalog.oid);\n",
54805480
toast_index_relfilenumber);
54815481
}
5482-
5483-
PQclear(upgrade_res);
54845482
}
54855483
else
54865484
{
@@ -5493,6 +5491,8 @@ binary_upgrade_set_pg_class_oids(Archive *fout,
54935491
relfilenumber);
54945492
}
54955493

5494+
PQclear(upgrade_res);
5495+
54965496
appendPQExpBufferChar(upgrade_buffer, '\n');
54975497

54985498
destroyPQExpBuffer(upgrade_query);

0 commit comments

Comments
 (0)