From 990b1c7c0592cb3812f44e434504c20ae3ae2671 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 20 Mar 2004 18:12:32 +0000 Subject: [PATCH] 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. --- src/bin/pg_dump/pg_dump.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 84d122a27d..dc3563ee2a 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -2403,6 +2403,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs, const char *tablename) else tblinfo[i].pkIndexOid = NULL; + PQclear(res2); } else tblinfo[i].pkIndexOid = NULL; @@ -2442,6 +2443,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs, const char *tablename) write_msg(NULL, "out of memory\n"); exit_nicely(); } + PQclear(res2); } else tblinfo[i].primary_key_name = NULL; @@ -2588,6 +2590,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs, const char *tablename) 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)); -- 2.39.5