]> granicus.if.org Git - postgresql/commitdiff
pg_restore: Fix memory and file descriptor leak with directory format
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 16 Mar 2012 17:53:31 +0000 (19:53 +0200)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 16 Mar 2012 17:57:45 +0000 (19:57 +0200)
found by Coverity

src/bin/pg_dump/pg_backup_directory.c

index 111c3e822a88d52dd5694cbcdde2c905468c9ca2..3936479cdafa8a22e099f94b900ec906c280109d 100644 (file)
@@ -365,6 +365,9 @@ _PrintFileData(ArchiveHandle *AH, char *filename, RestoreOptions *ropt)
                ahwrite(buf, 1, cnt, AH);
 
        free(buf);
+       if (cfclose(cfp) != 0)
+               die_horribly(AH, modulename, "could not close data file: %s\n",
+                                        strerror(errno));
 }
 
 /*