From: Tom Lane Date: Sat, 20 Mar 2004 18:12:32 +0000 (+0000) Subject: Repair multiple memory leaks in getTables(), including one that could X-Git-Tag: REL7_2_5~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fbec0d7e9459aa4e302bb029f248eef46de11c04;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 1d20a3decea..9a7036a818a 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.241.2.2 2002/05/28 15:40:36 tgl Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.241.2.3 2004/03/20 18:12:32 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -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));