git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cf4e603)
This patch fixes two tiny memory leaks in pg_dump and two in pg_dumpall.
2002年11月29日 16:38:42 +0000 (16:38 +0000)
2002年11月29日 16:38:42 +0000 (16:38 +0000)
Neil Conway


diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 09b9e4ac697e20b075da46edd0c07ef1744461e2..cfc5578d546d496660aae00f71e794ab54ef922e 100644 (file)
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -12,7 +12,7 @@
* by PostgreSQL
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.308 2002年11月23日 03:59:08 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.309 2002年11月29日 16:38:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -3226,6 +3226,7 @@ dumpOneDomain(Archive *fout, TypeInfo *tinfo)
"WHERE contypid = '%s'::pg_catalog.oid",
tinfo->oid);
+ PQclear(res);
res = PQexec(g_conn, chkquery->data);
if (!res ||
PQresultStatus(res) != PGRES_TUPLES_OK)
@@ -3269,6 +3270,7 @@ dumpOneDomain(Archive *fout, TypeInfo *tinfo)
destroyPQExpBuffer(q);
destroyPQExpBuffer(delq);
destroyPQExpBuffer(query);
+ destroyPQExpBuffer(chkquery);
}
/*
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 0c4bad7e06185a3cb65de6e9193b9e7ad131ce87..c3a769237407b50181763c2d71cc9afa77bad784 100644 (file)
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
*
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.10 2002年11月22日 03:09:43 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.11 2002年11月29日 16:38:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -403,7 +403,7 @@ dumpCreateDB(PGconn *conn)
for (i = 0; i < PQntuples(res); i++)
{
- PQExpBuffer buf = createPQExpBuffer();
+ PQExpBuffer buf;
char *dbname = PQgetvalue(res, i, 0);
char *dbowner = PQgetvalue(res, i, 1);
char *dbencoding = PQgetvalue(res, i, 2);
@@ -413,6 +413,8 @@ dumpCreateDB(PGconn *conn)
if (strcmp(dbname, "template1") == 0)
continue;
+ buf = createPQExpBuffer();
+
if (output_clean)
appendPQExpBuffer(buf, "DROP DATABASE %s\n;", fmtId(dbname));
@@ -692,6 +694,7 @@ connectDatabase(const char *dbname, const char *pghost, const char *pgport,
exit(1);
}
}
+ PQclear(res);
return conn;
}
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /