diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-03-20 18:12:32 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-03-20 18:12:32 +0000 |
commit | fbec0d7e9459aa4e302bb029f248eef46de11c04 (patch) | |
tree | 836e80044ee0e6c74546d869bef395d79fc7807d | |
parent | 5925377401ef30036e78ac89c3d4edca12479161 (diff) | |
download | postgresql-fbec0d7e9459aa4e302bb029f248eef46de11c04.tar.gz |
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.c | 5 |
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 1d20a3dece..9a7036a818 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)); |