From 339851c9450f6b95f5cbf80c219d79c113c320c9 Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Wed, 3 Apr 2002 10:51:24 +0000 Subject: [PATCH] Fix a file descriptor leak in the display filter code. Noted by Chr. v. Stuckrad. fixes: #1144 --- commands.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/commands.c b/commands.c index 5090d198..0565f533 100644 --- a/commands.c +++ b/commands.c @@ -160,11 +160,14 @@ int mutt_display_message (HEADER *cur) res = mutt_copy_message (fpout, Context, cur, cmflags, (option (OPTWEED) ? (CH_WEED | CH_REORDER) : 0) | CH_DECODE | CH_FROM); - if ((fclose (fpout) != 0 && errno != EPIPE) || res == -1) + if ((safe_fclose (&fpout) != 0 && errno != EPIPE) || res == -1) { mutt_error (_("Could not copy message")); if (fpfilterout != NULL) + { mutt_wait_filter (filterpid); + safe_fclose (&fpfilterout); + } mutt_unlink (tempfile); return 0; } @@ -172,6 +175,9 @@ int mutt_display_message (HEADER *cur) if (fpfilterout != NULL && mutt_wait_filter (filterpid) != 0) mutt_any_key_to_continue (NULL); + safe_fclose (&fpfilterout); /* XXX - check result? */ + + #if defined(HAVE_PGP) || defined(HAVE_SMIME) /* update crypto information for this message */ cur->security |= crypt_query (cur->content); -- 2.50.1