From: Richard Russon Date: Tue, 14 May 2019 13:49:24 +0000 (+0100) Subject: fix leaks in mutt_pattern_comp() X-Git-Tag: 2019-10-25~206 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=370fa5c16094e3f3d64a25d5d2f67d42609dffc9;p=neomutt fix leaks in mutt_pattern_comp() --- diff --git a/pattern.c b/pattern.c index 76df32a68..e0095dc61 100644 --- a/pattern.c +++ b/pattern.c @@ -1537,6 +1537,8 @@ struct PatternHead *mutt_pattern_comp(/* const */ char *s, int flags, struct Buf SLIST_NEXT(SLIST_FIRST(last), entries) = pat; else curlist = tmp; + if (curlist != last) + FREE(&last); last = tmp; ps.dptr++; /* move past the ~ */ @@ -1613,6 +1615,8 @@ struct PatternHead *mutt_pattern_comp(/* const */ char *s, int flags, struct Buf mutt_buffer_strcpy(err, _("empty pattern")); return NULL; } + if (curlist != tmp) + FREE(&tmp); if (SLIST_NEXT(SLIST_FIRST(curlist), entries)) { tmp = mutt_pattern_node_new();