From: Bogdan Vukobratovic Date: Thu, 27 Jun 2019 20:02:12 +0000 (+0200) Subject: Fix memory leak when one of multiple DFF cells is removed in opt_rmdff X-Git-Tag: working-ls180~1239^2~1 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=35fa7b30574244e4f99373f2a790f004b4a1dbbb;p=yosys.git 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. --- diff --git a/passes/opt/opt_rmdff.cc b/passes/opt/opt_rmdff.cc index 5fc28ae92..17e0d7cd4 100644 --- a/passes/opt/opt_rmdff.cc +++ b/passes/opt/opt_rmdff.cc @@ -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; }