]> granicus.if.org Git - neomutt/commitdiff
Fix a file descriptor leak in the display filter code. Noted by
authorThomas Roessler <roessler@does-not-exist.org>
Wed, 3 Apr 2002 10:51:24 +0000 (10:51 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Wed, 3 Apr 2002 10:51:24 +0000 (10:51 +0000)
Chr. v. Stuckrad.

fixes: #1144

commands.c

index 5090d1989fbd34f9de8662865f5bcd6c277d2790..0565f53380f182c09dbeabc65be6507840115bda 100644 (file)
@@ -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);