]> granicus.if.org Git - re2c/commitdiff
libre2c: don't forget to free static lists (AST nodes, etc.) at the end of 'regfree()'.
authorUlya Trofimovich <skvadrik@gmail.com>
Wed, 26 Jun 2019 10:15:40 +0000 (11:15 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Wed, 26 Jun 2019 10:18:26 +0000 (11:18 +0100)
Otherwise they accumulate at every 'regcomp()'.

lib/regfree.cc

index 5222f64d82713ea7763865ab7ad2ca655f3213b9..2779b672264c5fe32ef32e13b58ac7980a14634b 100644 (file)
@@ -1,7 +1,8 @@
 #include "lib/regex.h"
 #include "lib/regex_impl.h"
-#include "src/nfa/nfa.h"
 #include "src/dfa/dfa.h"
+#include "src/encoding/range_suffix.h"
+#include "src/nfa/nfa.h"
 
 
 using namespace re2c;
@@ -40,4 +41,7 @@ void regfree(regex_t *preg)
         delete &preg->dfa->tcpool;
         delete preg->dfa;
     }
+
+    AST::flist.clear();
+    RangeSuffix::freeList.clear();
 }