couvreur99_new: fix two memory leaks found by ASAN
This only occurs when doing the emptiness check of twa with allocated states. * spot/twaalgos/couvreurnew.cc: Here. * NEWS: Mention the bug.
This commit is contained in:
parent
b86cbf0514
commit
933c4cde0c
2 changed files with 29 additions and 3 deletions
5
NEWS
5
NEWS
|
|
@ -204,6 +204,11 @@ New in spot 2.4.2.dev (not yet released)
|
||||||
been removed. It's a low-level function was not used anywhere in
|
been removed. It's a low-level function was not used anywhere in
|
||||||
Spot anymore, since it's better to use spot::twa::copy_ap_of().
|
Spot anymore, since it's better to use spot::twa::copy_ap_of().
|
||||||
|
|
||||||
|
Bug fixes:
|
||||||
|
|
||||||
|
- couvreur99_new() leaked memory when processing TωA that allocate
|
||||||
|
states.
|
||||||
|
|
||||||
New in spot 2.4.2 (2017-11-07)
|
New in spot 2.4.2 (2017-11-07)
|
||||||
|
|
||||||
Tools:
|
Tools:
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ namespace spot
|
||||||
using state_t = const state*;
|
using state_t = const state*;
|
||||||
using iterator_t = twa_succ_iterator*;
|
using iterator_t = twa_succ_iterator*;
|
||||||
template<class val>
|
template<class val>
|
||||||
using state_map = state_map<val>;
|
using state_map = spot::state_map<val>;
|
||||||
|
|
||||||
template<class val>
|
template<class val>
|
||||||
static
|
static
|
||||||
|
|
@ -290,6 +290,11 @@ namespace spot
|
||||||
init<is_explicit>();
|
init<is_explicit>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~couvreur99_new_status()
|
||||||
|
{
|
||||||
|
uninit<is_explicit>();
|
||||||
|
}
|
||||||
|
|
||||||
automaton_ptr<is_explicit> aut;
|
automaton_ptr<is_explicit> aut;
|
||||||
std::stack<scc> root;
|
std::stack<scc> root;
|
||||||
typename T::template state_map<int> h;
|
typename T::template state_map<int> h;
|
||||||
|
|
@ -304,10 +309,26 @@ namespace spot
|
||||||
h.resize(aut->num_states(), 0);
|
h.resize(aut->num_states(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<bool U>
|
||||||
|
typename std::enable_if<U>::type
|
||||||
|
uninit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
template<bool U>
|
template<bool U>
|
||||||
typename std::enable_if<!U>::type
|
typename std::enable_if<!U>::type
|
||||||
init()
|
init()
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template<bool U>
|
||||||
|
typename std::enable_if<!U>::type
|
||||||
|
uninit()
|
||||||
|
{
|
||||||
|
auto i = h.begin();
|
||||||
|
while (i != h.end())
|
||||||
|
i++->first->destroy();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<bool is_explicit>
|
template<bool is_explicit>
|
||||||
|
|
@ -723,7 +744,6 @@ namespace spot
|
||||||
// We have a successor to look at.
|
// We have a successor to look at.
|
||||||
inc_transitions();
|
inc_transitions();
|
||||||
// Fetch the values we are interested in...
|
// Fetch the values we are interested in...
|
||||||
state_t dest = succ->dst();
|
|
||||||
auto acc = succ->acc();
|
auto acc = succ->acc();
|
||||||
if (!need_accepting_run)
|
if (!need_accepting_run)
|
||||||
if (strength == TERMINAL && ecs_->aut->acc().accepting(acc))
|
if (strength == TERMINAL && ecs_->aut->acc().accepting(acc))
|
||||||
|
|
@ -739,6 +759,7 @@ namespace spot
|
||||||
// We do not need an accepting run.
|
// We do not need an accepting run.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
state_t dest = succ->dst();
|
||||||
// ... and point the iterator to the next successor, for
|
// ... and point the iterator to the next successor, for
|
||||||
// the next iteration.
|
// the next iteration.
|
||||||
todo.top().second->next();
|
todo.top().second->next();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue