Commit 8fe11196 authored by Damien Lefortier's avatar Damien Lefortier
Browse files

* src/eltlparse/eltlparse.yy: Fix a memory leak.

* src/eltltest/nfa.cc: Adjust.
* src/tgbaalgos/eltl2tgba_lacim.cc: Fix a memory leak.
parent 78f8f164
2009-06-09 Damien Lefortier <dam@lrde.epita.fr>
* src/eltlparse/eltlparse.yy: Fix a memory leak.
* src/eltltest/nfa.cc: Adjust.
* src/tgbaalgos/eltl2tgba_lacim.cc: Fix a memory leak.
2009-06-05 Guillaume Sadegh <sadegh@lrde.epita.fr> 2009-06-05 Guillaume Sadegh <sadegh@lrde.epita.fr>
Remove generated files that git follows. Remove generated files that git follows.
......
...@@ -400,20 +400,20 @@ nfa_arg: ARG ...@@ -400,20 +400,20 @@ nfa_arg: ARG
subformula: ATOMIC_PROP subformula: ATOMIC_PROP
{ {
$$ = parse_environment.require(*$1); $$ = parse_environment.require(*$1);
if (!$$) if (!$$)
{ {
std::string s = "unknown atomic proposition `"; std::string s = "unknown atomic proposition `";
s += *$1; s += *$1;
s += "' in environment `"; s += "' in environment `";
s += parse_environment.name(); s += parse_environment.name();
s += "'"; s += "'";
PARSE_ERROR(@1, s); PARSE_ERROR(@1, s);
delete $1; delete $1;
YYERROR; YYERROR;
} }
else else
delete $1; delete $1;
} }
| subformula ATOMIC_PROP subformula | subformula ATOMIC_PROP subformula
{ {
...@@ -425,6 +425,8 @@ subformula: ATOMIC_PROP ...@@ -425,6 +425,8 @@ subformula: ATOMIC_PROP
v.push_back($1); v.push_back($1);
v.push_back($3); v.push_back($3);
$$ = instanciate(i->second, v); $$ = instanciate(i->second, v);
spot::ltl::destroy($1);
spot::ltl::destroy($3);
} }
else else
{ {
...@@ -445,6 +447,9 @@ subformula: ATOMIC_PROP ...@@ -445,6 +447,9 @@ subformula: ATOMIC_PROP
{ {
CHECK_ARITY(@1, $1, $3->size(), formula_tree::arity(i->second)); CHECK_ARITY(@1, $1, $3->size(), formula_tree::arity(i->second));
$$ = instanciate(i->second, *$3); $$ = instanciate(i->second, *$3);
automatop::vec::iterator it = $3->begin();
while (it != $3->end())
spot::ltl::destroy(*it++);
delete $3; delete $3;
} }
else else
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <string> #include <string>
#include <set> #include <set>
#include <iostream> #include <iostream>
#include "ltlast/formula_tree.hh"
#include "ltlast/nfa.hh" #include "ltlast/nfa.hh"
using namespace spot::ltl; using namespace spot::ltl;
...@@ -37,7 +38,7 @@ dfs(nfa& a, const nfa::state* s, mset& m) ...@@ -37,7 +38,7 @@ dfs(nfa& a, const nfa::state* s, mset& m)
for (nfa::iterator i = a.begin(s); i != a.end(s); ++i) for (nfa::iterator i = a.begin(s); i != a.end(s); ++i)
{ {
std::cout << (*i)->label << std::endl; std::cout << (*i)->lbl << std::endl;
dfs(a, (*i)->dst, m); dfs(a, (*i)->dst, m);
} }
} }
...@@ -47,8 +48,13 @@ main() ...@@ -47,8 +48,13 @@ main()
{ {
nfa a; nfa a;
a.add_transition(0, 1, 1); formula_tree::node_atomic* n1 = new formula_tree::node_atomic;
a.add_transition(1, 2, 2); formula_tree::node_atomic* n2 = new formula_tree::node_atomic;
n1->i = 1;
n2->i = 2;
a.add_transition(0, 1, formula_tree::node_ptr(n1));
a.add_transition(1, 2, formula_tree::node_ptr(n2));
std::cout << "init: " << a.format_state(a.get_init_state()) << std::endl; std::cout << "init: " << a.format_state(a.get_init_state()) << std::endl;
......
...@@ -92,11 +92,9 @@ namespace spot ...@@ -92,11 +92,9 @@ namespace spot
{ {
// Ensure finish_[node->child()] has been computed if // Ensure finish_[node->child()] has been computed if
// node->child() is an automaton operator. // node->child() is an automaton operator.
bdd f = recurse(node->child()); res_ = recurse(node->child());
finish_map_::const_iterator it = finish_.find(node->child()); finish_map_::const_iterator it = finish_.find(node->child());
if (it == finish_.end()) if (it != finish_.end())
res_ = f;
else
res_ = finish_[node->child()]; res_ = finish_[node->child()];
return; return;
} }
...@@ -240,7 +238,9 @@ namespace spot ...@@ -240,7 +238,9 @@ namespace spot
bdd tmpacc = bddfalse; bdd tmpacc = bddfalse;
for (nfa::iterator i = nfa->begin(s); i != nfa->end(s); ++i) for (nfa::iterator i = nfa->begin(s); i != nfa->end(s); ++i)
{ {
bdd f = recurse(formula_tree::instanciate((*i)->lbl, v)); const formula* lbl = formula_tree::instanciate((*i)->lbl, v);
bdd f = recurse(lbl);
destroy(lbl);
if (nfa->is_final((*i)->dst)) if (nfa->is_final((*i)->dst))
{ {
tmp1 |= f; tmp1 |= f;
...@@ -290,7 +290,7 @@ namespace spot ...@@ -290,7 +290,7 @@ namespace spot
// Traverse the formula and draft the automaton in a factory. // Traverse the formula and draft the automaton in a factory.
tgba_bdd_concrete_factory fact(dict); tgba_bdd_concrete_factory fact(dict);
eltl_trad_visitor v(fact, true); eltl_trad_visitor v(fact, true);
f2->accept(v); f->accept(v);
ltl::destroy(f2); ltl::destroy(f2);
fact.finish(); fact.finish();
......
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