8000 Repair multiple memory leaks in getTables(), including one that could · danielcode/postgres@3c06653 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3c06653

Browse files
committed
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.
1 parent a59881a commit 3c06653

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*
2323
*
2424
* IDENTIFICATION
25-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.205.2.4 2001/08/03 20:14:06 tgl Exp $
25+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.205.2.5 2004/03/20 18:12:50 tgl Exp $
2626
*
2727
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
2828
*
@@ -2311,6 +2311,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
23112311
else
23122312
tblinfo[i].pkIndexOid = NULL;
23132313

2314+
PQclear(res2);
23142315
}
23152316
else
23162317
tblinfo[i].pkIndexOid = NULL;
@@ -2383,6 +2384,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
23832384
perror("strdup");
23842385
exit(1);
23852386
}
2387+
PQclear(res2);
23862388
}
23872389
else
23882390
tblinfo[i].primary_key_name = NULL;
@@ -2533,6 +2535,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
25332535
else
25342536
tgfunc = strdup(finfo[findx].proname);
25352537

2538+
resetPQExpBuffer(delqry);
25362539
appendPQExpBuffer(delqry, "DROP TRIGGER %s ", fmtId(tgname, force_quotes));
25372540
appendPQExpBuffer(delqry, "ON %s;\n",
25382541
fmtId(tblinfo[i].relname, force_quotes));

0 commit comments

Comments
 (0)
0