ltlsynt: fix a memory leak

* bin/ltlsynt.cc: Declare the realizability_simplifier as a unique_ptr
so that it gets deleted after use.
* NEWS: Mention the bug.
This commit is contained in:
Alexandre Duret-Lutz 2025-02-06 17:15:48 +01:00
parent aba0e8dd24
commit 27fb175276
2 changed files with 8 additions and 6 deletions

2
NEWS
View file

@ -117,6 +117,8 @@ New in spot 2.12.2.dev (not yet released)
status and the AIG circuit; it now does the job silently as status and the AIG circuit; it now does the job silently as
requested. requested.
- ltlsynt had a minor memory leak
New in spot 2.12.2 (2025-01-18) New in spot 2.12.2 (2025-01-18)
Bug fixes: Bug fixes:

View file

@ -489,7 +489,7 @@ namespace
}; };
// Attempt to remove superfluous atomic propositions // Attempt to remove superfluous atomic propositions
spot::realizability_simplifier* rs = nullptr; std::unique_ptr<spot::realizability_simplifier> rs = nullptr;
if (opt_polarity != pol_no || opt_gequiv != pol_no) if (opt_polarity != pol_no || opt_gequiv != pol_no)
{ {
unsigned opt = 0; unsigned opt = 0;
@ -502,9 +502,9 @@ namespace
else else
opt |= spot::realizability_simplifier::global_equiv; opt |= spot::realizability_simplifier::global_equiv;
} }
rs = rs.reset(new spot::realizability_simplifier(original_f, input_aps, opt,
new spot::realizability_simplifier(original_f, input_aps, opt, gi ? gi->verbose_stream
gi ? gi->verbose_stream : nullptr); : nullptr));
f = rs->simplified_formula(); f = rs->simplified_formula();
} }
@ -646,7 +646,7 @@ namespace
} }
if (want_game()) if (want_game())
{ {
dispatch_print_hoa(arena, rs); dispatch_print_hoa(arena, rs.get());
continue; continue;
} }
if (!spot::solve_game(arena, *gi)) if (!spot::solve_game(arena, *gi))
@ -732,7 +732,7 @@ namespace
if (gi->bv) if (gi->bv)
sw2.start(); sw2.start();
saig = spot::mealy_machines_to_aig(mealy_machines, opt_aiger, saig = spot::mealy_machines_to_aig(mealy_machines, opt_aiger,
input_aps, sub_outs_str, rs); input_aps, sub_outs_str, rs.get());
if (gi->bv) if (gi->bv)
{ {
gi->bv->aig_time = sw2.stop(); gi->bv->aig_time = sw2.stop();