Fix memory leak when one of multiple DFF cells is removed in opt_rmdff

When there are multiple DFFs and one of them is removed, its reference lingers
inside bit2driver dict. While invoking handle_dff() function for other DFFs,
this broken reference is used isnside sat_import_cell() function.
This commit is contained in:
Bogdan Vukobratovic 2019-06-27 22:02:12 +02:00
parent 0f32cb4e0a
commit 35fa7b3057
1 changed files with 5 additions and 0 deletions

View File

@ -530,6 +530,11 @@ delete_dff:
log("Removing %s (%s) from module %s.\n", log_id(dff), log_id(dff->type), log_id(mod));
remove_init_attr(dff->getPort("\\Q"));
mod->remove(dff);
for (auto &entry : bit2driver)
if (entry.second == dff)
bit2driver.erase(entry.first);
return true;
}