From 370fa5c16094e3f3d64a25d5d2f67d42609dffc9 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Tue, 14 May 2019 14:49:24 +0100 Subject: [PATCH] fix leaks in mutt_pattern_comp() --- pattern.c | 4 ++++ 1 file changed, 4 insertions(+) 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(); -- 2.40.0