diff options
author | Marc G. Fournier <scrappy@hub.org> | 1997-06-02 02:52:06 +0000 |
---|---|---|
committer | Marc G. Fournier <scrappy@hub.org> | 1997-06-02 02:52:06 +0000 |
commit | f9f98e3aff781271b5f3df4f8df61acc83dc6ce3 (patch) | |
tree | 549e675b1eaf276585a03d8cab73bc2976cedb33 /src/bin/pg_dump/common.c | |
parent | a27fafecc58ae6ba1566d5a8db51067046818dfd (diff) |
From: Igor <igor@sba.miami.edu>
Subject: [PATCHES] pg_dump memory leak patch
This patch fixes a HUGE memory leak problem in pg_dump.
Pretty much anything that was allocated was never freed and Purify
reported about 40% possible memory leak and 6% actual leak. I added
functions to clear out all the allocated structures. After the patch
Purify returns 0 for number of bytes leaked...
Diffstat (limited to 'src/bin/pg_dump/common.c')
-rw-r--r-- | src/bin/pg_dump/common.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index f12510dc3b1..1fdd8486720 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.11 1997/04/12 09:23:59 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.12 1997/06/02 02:51:49 scrappy Exp $ * * Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2 * @@ -203,12 +203,12 @@ dumpSchema(FILE *fout, int numInherits; int numAggregates; int numOperators; - TypeInfo *tinfo; - FuncInfo *finfo; - AggInfo *agginfo; - TableInfo *tblinfo; - InhInfo *inhinfo; - OprInfo *oprinfo; + TypeInfo *tinfo=NULL; + FuncInfo *finfo=NULL; + AggInfo *agginfo=NULL; + TableInfo *tblinfo=NULL; + InhInfo *inhinfo=NULL; + OprInfo *oprinfo=NULL; if (g_verbose) fprintf(stderr,"%s reading user-defined types %s\n", g_comment_start, g_comment_end); @@ -274,10 +274,14 @@ if (!tablename && fout) { } *numTablesPtr = numTables; + clearAggInfo(agginfo,numAggregates); + clearOprInfo(oprinfo,numOperators); + clearTypeInfo(tinfo, numTypes); + clearFuncInfo(finfo,numFuncs); + clearInhInfo(inhinfo,numInherits); return tblinfo; } - /* * dumpSchemaIdx: * dump indexes at the end for performance @@ -300,6 +304,7 @@ dumpSchemaIdx(FILE *fout, int *numTablesPtr, const char *tablename, g_comment_start, g_comment_end); dumpIndices(fout, indinfo, numIndices, tblinfo, numTables, tablename); } + clearIndInfo(indinfo,numIndices); } /* flagInhAttrs - @@ -409,9 +414,3 @@ isArchiveName(const char* relname) { return (strlen(relname) > 1 && relname[1] == ','); } - - - - - - |