From 5d1f5079ab5308373420f0995864c09216de4e8f Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Sun, 11 Jan 2026 13:52:50 -0600 Subject: [PATCH] pg_dump: Fix memory leak in dumpSequenceData(). Oversight in commit 7a485bd641. Per Coverity. Backpatch-through: 18 --- src/bin/pg_dump/pg_dump.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index b9e0edf8755..328a1bad21b 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -19230,12 +19230,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()