From: Eddie Hung Date: Fri, 10 Jan 2020 18:46:06 +0000 (-0800) Subject: abc9: fix memory leak X-Git-Tag: working-ls180~875^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1f7893bd8c8d88f2a84b9bcba67acf43cee0430f;p=yosys.git abc9: fix memory leak --- diff --git a/passes/techmap/abc9.cc b/passes/techmap/abc9.cc index 8cb34e523..3fc6ed2c2 100644 --- a/passes/techmap/abc9.cc +++ b/passes/techmap/abc9.cc @@ -416,13 +416,11 @@ void abc9_module(RTLIL::Design *design, RTLIL::Module *module, std::string scrip dict abc9_box; vector boxes; - for (auto it = module->cells_.begin(); it != module->cells_.end(); ) { - auto cell = it->second; + for (auto cell : module->cells().to_vector()) { if (cell->type.in(ID($_AND_), ID($_NOT_), ID($__ABC9_FF_))) { - it = module->cells_.erase(it); + module->remove(cell); continue; } - ++it; RTLIL::Module* box_module = design->module(cell->type); auto jt = abc9_box.find(cell->type); if (jt == abc9_box.end())