From 55207f2ce58d2ecde6a3274147d3162c987cb510 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 14 Sep 2015 23:59:03 -0700 Subject: Fix memory leak in regexes. * regex.c (nfa_free): The visited marker must be incremented, otherwise nfa_all_states will only collect start and accept. --- regex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'regex.c') diff --git a/regex.c b/regex.c index fa825ab3..fd404b8b 100644 --- a/regex.c +++ b/regex.c @@ -1104,7 +1104,7 @@ static void nfa_free(nfa_t nfa) all[0] = nfa.start; all[1] = nfa.accept; - nstates = nfa_all_states(all, 2, nfa.start->a.visited); + nstates = nfa_all_states(all, 2, nfa.start->a.visited + 1); for (i = 0; i < nstates; i++) nfa_state_free(all[i]); -- cgit v1.2.3