]> granicus.if.org Git - neomutt/commitdiff
fix leaks in mutt_pattern_comp()
authorRichard Russon <rich@flatcap.org>
Tue, 14 May 2019 13:49:24 +0000 (14:49 +0100)
committerRichard Russon <rich@flatcap.org>
Thu, 16 May 2019 10:52:33 +0000 (11:52 +0100)
pattern.c

index 76df32a682569d4e25ca75fc2c3a0d5780da4ca6..e0095dc617f09349fd1f8a0e38408367fca68024 100644 (file)
--- 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();