From: Tom Lane Date: Sat, 20 Mar 2004 18:12:50 +0000 (+0000) Subject: Repair multiple memory leaks in getTables(), including one that could X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3c06653fbd58d5e3708bb6b251e66321a35a5f39;p=thirdparty%2Fpostgresql.git 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. --- 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 - dave@bensoft.com - 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));