Skip to content

Commit

Permalink
Fix memory leak.
Browse files Browse the repository at this point in the history
The edge sets leak when halting with FSM_DETERMINISE_WITH_CONFIG_STATE_LIMIT_REACHED.
  • Loading branch information
silentbicycle committed Nov 7, 2024
1 parent 6dc7305 commit 7ebc1eb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libfsm/determinise.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ fsm_determinise_with_config(struct fsm *nfa,
assert(dfa->states[m->dfastate].edges == NULL);

dfa->states[m->dfastate].edges = m->edges;
m->edges = NULL; /* transfer ownership */

/*
* The current DFA state is an end state if any of its associated NFA
Expand Down Expand Up @@ -593,6 +594,8 @@ map_free(struct map *map)
if (b == NULL) {
continue;
}
/* free any edge sets that didn't get transferred */
edge_set_free(map->alloc, b->edges);
f_free(map->alloc, b);
}

Expand Down

0 comments on commit 7ebc1eb

Please sign in to comment.