1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-12 15:23:02 +03:00

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.
This commit is contained in:
Tom Lane
2004-03-20 18:12:32 +00:00
parent 5925377401
commit fbec0d7e94

View File

@@ -22,7 +22,7 @@
* *
* *
* IDENTIFICATION * 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 else
tblinfo[i].pkIndexOid = NULL; tblinfo[i].pkIndexOid = NULL;
PQclear(res2);
} }
else else
tblinfo[i].pkIndexOid = NULL; 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"); write_msg(NULL, "out of memory\n");
exit_nicely(); exit_nicely();
} }
PQclear(res2);
} }
else else
tblinfo[i].primary_key_name = NULL; tblinfo[i].primary_key_name = NULL;
@@ -2588,6 +2590,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs, const char *tablename)
else else
tgfunc = strdup(finfo[findx].proname); tgfunc = strdup(finfo[findx].proname);
resetPQExpBuffer(delqry);
appendPQExpBuffer(delqry, "DROP TRIGGER %s ", fmtId(tgname, force_quotes)); appendPQExpBuffer(delqry, "DROP TRIGGER %s ", fmtId(tgname, force_quotes));
appendPQExpBuffer(delqry, "ON %s;\n", appendPQExpBuffer(delqry, "ON %s;\n",
fmtId(tblinfo[i].relname, force_quotes)); fmtId(tblinfo[i].relname, force_quotes));