From: Nathan Bossart Date: Sun, 11 Jan 2026 19:52:50 +0000 (-0600) Subject: pg_dump: Fix memory leak in dumpSequenceData(). X-Git-Tag: REL_18_2~68 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=56e1f501010fc79fd1d11df6fd04eec463d40319;p=thirdparty%2Fpostgresql.git pg_dump: Fix memory leak in dumpSequenceData(). Oversight in commit 7a485bd641. Per Coverity. Backpatch-through: 18 --- diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index b00ba35f87c..583afc67d3f 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -19056,12 +19056,14 @@ dumpSequenceData(Archive *fout, const TableDataInfo *tdinfo) TableInfo *tbinfo = tdinfo->tdtable; int64 last; bool called; - PQExpBuffer query = createPQExpBuffer(); + PQExpBuffer query; /* needn't bother if not dumping sequence data */ if (!fout->dopt->dumpData && !fout->dopt->sequence_data) return; + query = createPQExpBuffer(); + /* * For versions >= 18, the sequence information is gathered in the sorted * array before any calls to dumpSequenceData(). See collectSequences()