From: Kevin McCarthy Date: Wed, 13 Jul 2016 01:04:28 +0000 (-0700) Subject: Fix BODY->d_filename memory leaks. X-Git-Tag: mutt-1-7-rel~31 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=717cbe335930c4db610051f257254254bcd0fbe0;p=mutt Fix BODY->d_filename memory leaks. mutt_message_to_7bit() and transform_to_7bit() were overwriting d_filename without freeing the previous value. mutt_free_body() was not freeing the d_filename pointer. --- diff --git a/muttlib.c b/muttlib.c index 7cf06257..209c7ab9 100644 --- a/muttlib.c +++ b/muttlib.c @@ -178,6 +178,7 @@ void mutt_free_body (BODY **p) } FREE (&b->filename); + FREE (&b->d_filename); FREE (&b->charset); FREE (&b->content); FREE (&b->xtype); diff --git a/sendlib.c b/sendlib.c index 8b96ce78..771eae2d 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1093,6 +1093,7 @@ void mutt_message_to_7bit (BODY *a, FILE *fp) return; a->encoding = ENC7BIT; + FREE (&a->d_filename); a->d_filename = a->filename; if (a->filename && a->unlink) unlink (a->filename); @@ -1142,6 +1143,7 @@ static void transform_to_7bit (BODY *a, FILE *fpin) s.fpin = fpin; mutt_decode_attachment (a, &s); safe_fclose (&s.fpout); + FREE (&a->d_filename); a->d_filename = a->filename; a->filename = safe_strdup (buff); a->unlink = 1;