changeset: 6550:cf4c1c21e58d
user: Kevin McCarthy <[email protected]>
date: Mon Jan 04 16:28:56 2016 -0800
link: http://dev.mutt.org/hg/mutt/rev/cf4c1c21e58d
Add a couple missing ATTACHPTR->tree frees.
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.
diffs (22 lines):
diff -r 960017a249f7 -r cf4c1c21e58d compose.c
--- a/compose.c Mon Jan 04 13:57:40 2016 -0800
+++ b/compose.c Mon Jan 04 16:28:56 2016 -0800
@@ -629,7 +629,10 @@
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 @@
for (i = 0; i < idxlen; i++)
{
idx[i]->content->aptr = NULL;
+ FREE (&idx[i]->tree);
FREE (&idx[i]);
}
}