]> granicus.if.org Git - neomutt/commitdiff
Add a couple missing ATTACHPTR->tree frees.
authorKevin McCarthy <kevin@8t8.us>
Tue, 5 Jan 2016 00:28:56 +0000 (16:28 -0800)
committerKevin McCarthy <kevin@8t8.us>
Tue, 5 Jan 2016 00:28:56 +0000 (16:28 -0800)
While working on ticket 3800, I noticed the tree wasn't being freed
inside OP_COMPOSE_EDIT_HEADERS.  Add a free there, and in the cleanup
at the end of mutt_compose_menu().

A few other sections in mutt_compose_menu() are performing a
free-on-error where the tree isn't allocated yet, so skip it for
those.

I believe this is actually not fixing a memory leak: all attachments
are always at level 0 in the compose menu (as far as I know); so
nothing is ever allocated in the tree pointer.  However since other
parts of the code in compose.c clean this up, it make sense to add
them here too.

compose.c

index 7134287b26a7f26a9694971e59dc05adb5bb72d2..a0f9c4ac039869a9a2389c0c180f186b2f9622f0 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -629,7 +629,10 @@ int mutt_compose_menu (HEADER *msg,   /* structure for new message */
        if (idxlen && idx[idxlen - 1]->content->next)
        {
          for (i = 0; i < idxlen; i++)
+          {
+            FREE (&idx[i]->tree);
            FREE (&idx[i]);
+          }
          idxlen = 0;
          idx = mutt_gen_attach_list (msg->content, -1, idx, &idxlen, &idxmax, 0, 1);
          menu->data = idx;
@@ -1321,6 +1324,7 @@ int mutt_compose_menu (HEADER *msg,   /* structure for new message */
     for (i = 0; i < idxlen; i++)
     {
       idx[i]->content->aptr = NULL;
+      FREE (&idx[i]->tree);
       FREE (&idx[i]);
     }
   }