Commit 99533561 authored by Damien Lefortier's avatar Damien Lefortier
Browse files

Fix some memory leaks.

* src/eltlparse/eltlparse.yy: Free the automatop::vec when
CHECK_ARITY fails while parsing an automatop.
* src/eltltest/acc.cc: Free all constructed formulae.
parent 4964c9a1
2009-09-07 Damien Lefortier <dam@lrde.epita.fr>
Fix some memory leaks.
* src/eltlparse/eltlparse.yy: Free the automatop::vec when
CHECK_ARITY fails while parsing an automatop.
* src/eltltest/acc.cc: Free all constructed formulae.
2009-09-07 Alexandre Duret-Lutz <adl@lrde.epita.fr>
Fix a memory leak in reduce_tau03().
......
......@@ -457,7 +457,17 @@ subformula: ATOMIC_PROP
CHECK_EXISTING_NMAP(@1, $1);
nfa::ptr np = nmap[*$1];
CHECK_ARITY(@1, $1, $3->size(), np->arity());
/// Easily handle deletion of $3 when CHECK_ARITY fails.
int i = $3->size();
if ($3->size() != np->arity())
{
automatop::vec::iterator it = $3->begin();
while (it != $3->end())
spot::ltl::destroy(*it++);
delete $3;
}
CHECK_ARITY(@1, $1, i, np->arity());
$$ = automatop::instance(np, $3, false);
}
delete $1;
......@@ -484,7 +494,6 @@ subformula: ATOMIC_PROP
arg_list: subformula
{
// TODO: delete it whenever a parse error occurs on a subformula.
$$ = new automatop::vec;
$$->push_back($1);
}
......
......@@ -36,7 +36,10 @@ main(int argc, char** argv)
if (spot::eltl::format_parse_errors(std::cerr, p))
{
if (f != 0)
{
std::cout << f->dump() << std::endl;
spot::ltl::destroy(f);
}
return 1;
}
......@@ -46,6 +49,9 @@ main(int argc, char** argv)
assert(f != 0);
std::cout << f->dump() << std::endl;
spot::ltl::destroy(f);
assert(f2 != 0);
std::cout << f2->dump() << std::endl;
spot::ltl::destroy(f2);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment