From: Thomas Roessler Date: Wed, 3 Apr 2002 10:51:24 +0000 (+0000) Subject: Fix a file descriptor leak in the display filter code. Noted by X-Git-Tag: mutt-1-5-1-rel~23 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=339851c9450f6b95f5cbf80c219d79c113c320c9;p=mutt Fix a file descriptor leak in the display filter code. Noted by Chr. v. Stuckrad. fixes: #1144 --- 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);