postgres.git / summary / log / commit / refs
commit 56e1f501010fc79fd1d11df6fd04eec463d40319
Author: Nathan Bossart <nathan@postgresql.org>
Date: Sun Jan 11 19:52:50 2026 +0000
First released in: 19.0, 18.2
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 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()
[parent: d2c6ff7c525b]