summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2004-03-20 18:12:50 +0000
committerTom Lane2004-03-20 18:12:50 +0000
commit3c06653fbd58d5e3708bb6b251e66321a35a5f39 (patch)
treec41d4440c7fe58e8312ac7d967aa107079426d4c
parenta59881aae1681fe25918327b6cb6ec80c7721029 (diff)
Repair multiple memory leaks in getTables(), including one that could
easily exhaust memory on databases with more than a few hundred triggers. I don't expect any more releases of these old versions, but let's put the fix in CVS just so it's archived.
-rw-r--r--src/bin/pg_dump/pg_dump.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 977316396be..f9c595ac8e5 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -22,7 +22,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.205.2.4 2001/08/03 20:14:06 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.205.2.5 2004/03/20 18:12:50 tgl Exp $
*
* Modifications - 6/10/96 - [email protected] - version 1.13.dhb
*
@@ -2311,6 +2311,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
else
tblinfo[i].pkIndexOid = NULL;
+ PQclear(res2);
}
else
tblinfo[i].pkIndexOid = NULL;
@@ -2383,6 +2384,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
perror("strdup");
exit(1);
}
+ PQclear(res2);
}
else
tblinfo[i].primary_key_name = NULL;
@@ -2533,6 +2535,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
else
tgfunc = strdup(finfo[findx].proname);
+ resetPQExpBuffer(delqry);
appendPQExpBuffer(delqry, "DROP TRIGGER %s ", fmtId(tgname, force_quotes));
appendPQExpBuffer(delqry, "ON %s;\n",
fmtId(tblinfo[i].relname, force_quotes));