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.
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;
for (i = 0; i < idxlen; i++)
{
idx[i]->content->aptr = NULL;
+ FREE (&idx[i]->tree);
FREE (&idx[i]);
}
}