From f4590995c9884334bdb9c5f6b90e985bc9d91289 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 2 Jul 2002 05:49:52 +0000 Subject: [PATCH] The attached patch fixes 2 memory leaks in pg_dump, as well as corrects a spelling mistake and deletes an antiquated comment. Neil Conway --- src/bin/pg_dump/pg_backup_archiver.c | 4 ++-- src/bin/pg_dump/pg_dump.c | 13 +++++++++++-- src/bin/pg_dump/pg_dump.h | 7 +------ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index f9ea0cfdcc..e6e9bddd99 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.49 2002/05/29 01:49:57 tgl Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.50 2002/07/02 05:49:51 momjian Exp $ * * Modifications - 28-Jun-2000 - pjw@rhyme.com.au * @@ -2371,7 +2371,7 @@ _SortToc(ArchiveHandle *AH, TocSortCompareFn fn) /* Sort it, but ignore the header entries */ qsort(&(tea[1]), AH->tocCount, sizeof(TocEntry *), fn); - /* Rebuild list: this works becuase we have headers at each end */ + /* Rebuild list: this works because we have headers at each end */ for (i = 1; i <= AH->tocCount; i++) { tea[i]->next = tea[i + 1]; diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index bedff93dce..a12e095b1f 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.267 2002/06/20 20:29:41 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.268 2002/07/02 05:49:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -967,10 +967,10 @@ dumpClasses_nodumpData(Archive *fout, char *oid, void *dctxv) write_msg(NULL, "SQL command to dump the contents of table \"%s\" failed: PQendcopy() failed.\n", classname); write_msg(NULL, "Error message from server: %s", PQerrorMessage(g_conn)); write_msg(NULL, "The command was: %s\n", q->data); - PQclear(res); exit_nicely(); } + PQclear(res); destroyPQExpBuffer(q); return 1; } @@ -4758,6 +4758,15 @@ dumpOneTable(Archive *fout, TableInfo *tbinfo, TableInfo *g_tblinfo) /* Dump Table Comments */ dumpTableComment(fout, tbinfo, reltypename, commentDeps); + if (commentDeps) + { + for (j = 0; (*commentDeps)[j] != NULL; j++) + { + free((void *) (*commentDeps)[j]); + } + free(commentDeps); + } + destroyPQExpBuffer(query); destroyPQExpBuffer(q); destroyPQExpBuffer(delq); diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h index f61096c122..3483fe2c0f 100644 --- a/src/bin/pg_dump/pg_dump.h +++ b/src/bin/pg_dump/pg_dump.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: pg_dump.h,v 1.88 2002/06/20 20:29:41 momjian Exp $ + * $Id: pg_dump.h,v 1.89 2002/07/02 05:49:52 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -156,11 +156,6 @@ extern char g_comment_end[10]; extern char g_opaque_type[10]; /* name for the opaque type */ -/* pg_dump is really two programs in one - one version works with postgres v4r2 - and the other works with postgreSQL - the common routines are declared here -*/ /* * common utility functions */ -- 2.40.0