]> granicus.if.org Git - postgresql/commitdiff
The attached patch fixes 2 memory leaks in pg_dump, as well as corrects
authorBruce Momjian <bruce@momjian.us>
Tue, 2 Jul 2002 05:49:52 +0000 (05:49 +0000)
committerBruce Momjian <bruce@momjian.us>
Tue, 2 Jul 2002 05:49:52 +0000 (05:49 +0000)
a spelling mistake and deletes an antiquated comment.

Neil Conway

src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.h

index f9ea0cfdcc4f9bd1fd3b92cf1e6983a2c9c88f70..e6e9bddd99da231ad62ca135227ffaf6737ac2de 100644 (file)
@@ -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];
index bedff93dce7a4865039049ec954e316ba57a3e46..a12e095b1fbac59fab0110e38e0b4dbf5fc7f691 100644 (file)
@@ -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);
index f61096c12210aff3bac049d463517da1c7d9e41b..3483fe2c0f6d2d8f698a5e106f06f94f5beffffc 100644 (file)
@@ -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
  */