From: Richard Russon Date: Thu, 16 Feb 2017 12:40:21 +0000 (+0000) Subject: fix: resource leak - CID 76985 X-Git-Tag: neomutt-20170225~14^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=644e23260c69d8a50dda6e8103348b6da05a183b;p=neomutt fix: resource leak - CID 76985 --- diff --git a/sendlib.c b/sendlib.c index ad3cd30b5..8c297051a 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1798,11 +1798,18 @@ static int write_one_header (FILE *fp, int pfxw, int max, int wraplen, "max width = %d <= %d\n", NONULL(pfx), valbuf, max, wraplen); if (pfx && *pfx) + { if (fputs (pfx, fp) == EOF) + { + FREE (&valbuf); return -1; + } + } + if (!(t = strchr (valbuf, ':'))) { mutt_debug (1, "mwoh: warning: header not in 'key: value' format!\n"); + FREE (&valbuf); return 0; } if (print_val (fp, pfx, valbuf, flags, mutt_strlen (pfx)) < 0) @@ -1842,7 +1849,10 @@ static int write_one_header (FILE *fp, int pfxw, int max, int wraplen, mutt_debug (4, "mwoh: buf[%s%s] too long, max width = %d > %d\n", NONULL(pfx), valbuf, max, wraplen); if (fold_one_header (fp, tagbuf, valbuf, pfx, wraplen, flags) < 0) + { + FREE (&valbuf); return -1; + } FREE (&tagbuf); FREE (&valbuf); }