]> granicus.if.org Git - neomutt/commitdiff
Fix memory leak in compose write-fcc function
authorKevin McCarthy <kevin@8t8.us>
Sun, 22 Sep 2019 22:59:27 +0000 (15:59 -0700)
committerRichard Russon <rich@flatcap.org>
Tue, 1 Oct 2019 10:25:08 +0000 (11:25 +0100)
The outer multipart was not being freed after writing.

Co-authored-by: Richard Russon <rich@flatcap.org>
compose.c

index 94b9a076e5e453d03c8181921a4be69eca92351e..c0dc283b2173b2985857e87b19eb91868e00a726 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -2133,10 +2133,10 @@ int mutt_compose_menu(struct Email *e, char *fcc, size_t fcclen, struct Email *e
           if (e->content->next)
             e->content = mutt_make_multipart(e->content);
 
-          if (mutt_write_fcc(mutt_b2s(&fname), e, NULL, false, NULL, NULL) < 0)
-            e->content = mutt_remove_multipart(e->content);
-          else
+          if (mutt_write_fcc(mutt_b2s(&fname), e, NULL, false, NULL, NULL) == 0)
             mutt_message(_("Message written"));
+
+          e->content = mutt_remove_multipart(e->content);
         }
         break;