summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2016-09-24 17:11:19 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2016-09-24 17:11:19 +0100
commitc0741086da04768bb4c9e896b311ad3c1166b631 (patch)
tree063227c143116f4704ff2485ccf276ed2db65d2e
parent4ae758e46af02b9da0f28fdbfad83eea5e0dffbe (diff)
downloadexim4-c0741086da04768bb4c9e896b311ad3c1166b631.tar.gz
Delivery: fix memory leak
-rw-r--r--src/src/deliver.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/src/deliver.c b/src/src/deliver.c
index 357c60702..eb6c70515 100644
--- a/src/src/deliver.c
+++ b/src/src/deliver.c
@@ -5555,7 +5555,11 @@ Otherwise it might be needed again. */
"journal file\n", big_buffer);
}
rewind(jread);
- journal_fd = fileno(jread);
+ if ((journal_fd = dup(fileno(jread))) < 0)
+ journal_fd = fileno(jread);
+ else
+ (void) fclose(jread); /* Try to not leak the FILE resource */
+
/* Panic-dies on error */
(void)spool_write_header(message_id, SW_DELIVERING, NULL);
}