Merge pull request #1624 from YosysHQ/eddie/abc9_leak

abc9: fix memory leak
This commit is contained in:
Eddie Hung 2020-01-10 11:28:38 -08:00 committed by GitHub
commit ed491939c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -416,13 +416,11 @@ void abc9_module(RTLIL::Design *design, RTLIL::Module *module, std::string scrip
dict<IdString, bool> abc9_box; dict<IdString, bool> abc9_box;
vector<RTLIL::Cell*> boxes; vector<RTLIL::Cell*> boxes;
for (auto it = module->cells_.begin(); it != module->cells_.end(); ) { for (auto cell : module->cells().to_vector()) {
auto cell = it->second;
if (cell->type.in(ID($_AND_), ID($_NOT_), ID($__ABC9_FF_))) { if (cell->type.in(ID($_AND_), ID($_NOT_), ID($__ABC9_FF_))) {
it = module->cells_.erase(it); module->remove(cell);
continue; continue;
} }
++it;
RTLIL::Module* box_module = design->module(cell->type); RTLIL::Module* box_module = design->module(cell->type);
auto jt = abc9_box.find(cell->type); auto jt = abc9_box.find(cell->type);
if (jt == abc9_box.end()) if (jt == abc9_box.end())