From: Mehdi Abaakouk Date: Fri, 15 Sep 2017 17:44:26 +0000 (+0200) Subject: imap: fix memory leak X-Git-Tag: neomutt-20171006~8^2~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d2f422d9e3401cf11cd71da6db40b78c89248349;p=neomutt imap: fix memory leak In imap_commit_message_tags() cmd is not freed in case of error. --- diff --git a/imap/imap.c b/imap/imap.c index 8b719bbc8..75cf15202 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -1392,7 +1392,10 @@ static int imap_commit_message_tags(struct Context *ctx, struct Header *h, char * continue to add new keywords * */ if (imap_exec(idata, cmd->data, 0) != 0) + { + mutt_buffer_free(&cmd); return -1; + } mutt_buffer_free(&cmd); } @@ -1415,6 +1418,7 @@ static int imap_commit_message_tags(struct Context *ctx, struct Header *h, char if (imap_exec(idata, cmd->data, 0) != 0) { mutt_debug(1, "imap_commit_message_tags: fail to add new keywords\n"); + mutt_buffer_free(&cmd); return -1; }