Skip to content
Snippets Groups Projects
Commit 2a3c7fb8 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

fix access deleted memory in state elimination

parent b5751161
No related branches found
No related tags found
No related merge requests found
......@@ -101,16 +101,16 @@ void ToRegExpStateElimination::extendExtendedNFA(automaton::ExtendedNFA < > & au
 
if(automaton.getFinalStates().size() > 1) {
DefaultStateType f = common::createUnique(label::FinalStateLabel::instance < DefaultStateType > ( ), automaton.getStates());
automaton.addState(f);
automaton.addState ( f );
 
for(const auto &state : automaton.getFinalStates() ) {
regexp::UnboundedRegExpStructure < DefaultSymbolType > regexp { regexp::UnboundedRegExpEpsilon < DefaultSymbolType > () };
automaton.addTransition(state, regexp, f);
automaton.removeFinalState(state);
}
 
automaton.addFinalState(f);
std::set < DefaultStateType > newFinalStates;
newFinalStates.insert ( f );
automaton.setFinalStates ( newFinalStates );
}
}
 
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment