From 5c5b9b78895f38a0f64850210e6aa23e104319ef Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 20 Mar 2004 18:12:50 +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 0a85fe0078..680120efe4 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -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)); -- 2.39.5