]> granicus.if.org Git - neomutt/commitdiff
fix leak in mutt_compose_attachment()
authorRichard Russon <rich@flatcap.org>
Mon, 13 Nov 2017 01:36:08 +0000 (01:36 +0000)
committerRichard Russon <rich@flatcap.org>
Wed, 15 Nov 2017 15:12:11 +0000 (15:12 +0000)
Move the `mutt_free_body()` before the two `goto bailout`s.

attach.c

index a5ac6762e3b6252556f840ceeff154bf298b6f26..ff9e9f0e97af1a75bbca5d4ad0f61666acbb8652 100644 (file)
--- a/attach.c
+++ b/attach.c
@@ -179,6 +179,7 @@ int mutt_compose_attachment(struct Body *a)
             /* Remove headers by copying out data to another file, then
              * copying the file back */
             fseeko(fp, b->offset, SEEK_SET);
+            mutt_free_body(&b);
             mutt_mktemp(tempfile, sizeof(tempfile));
             tfp = safe_fopen(tempfile, "w");
             if (!tfp)
@@ -195,8 +196,6 @@ int mutt_compose_attachment(struct Body *a)
               mutt_perror(_("Failure to rename file."));
               goto bailout;
             }
-
-            mutt_free_body(&b);
           }
         }
       }