From c0741086da04768bb4c9e896b311ad3c1166b631 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sat, 24 Sep 2016 17:11:19 +0100 Subject: [PATCH] Delivery: fix memory leak --- src/src/deliver.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); } -- 2.25.1