From b6948e15464d7e86c0d892619d9c90c9cfd124f1 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 16 Mar 2012 19:53:31 +0200 Subject: [PATCH] pg_restore: Fix memory and file descriptor leak with directory format found by Coverity --- src/bin/pg_dump/pg_backup_directory.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/bin/pg_dump/pg_backup_directory.c b/src/bin/pg_dump/pg_backup_directory.c index 111c3e822a..3936479cda 100644 --- a/src/bin/pg_dump/pg_backup_directory.c +++ b/src/bin/pg_dump/pg_backup_directory.c @@ -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)); } /* -- 2.40.0