aboutsummaryrefslogtreecommitdiffstats
path: root/passes/opt
diff options
context:
space:
mode:
authorBogdan Vukobratovic <bogdan.vukobratovic@gmail.com>2019-06-27 22:02:12 +0200
committerBogdan Vukobratovic <bogdan.vukobratovic@gmail.com>2019-06-27 22:02:12 +0200
commit35fa7b30574244e4f99373f2a790f004b4a1dbbb (patch)
tree15c78bc27293b428d2e8879b23e9370b88e2b800 /passes/opt
parent0f32cb4e0af85e16a90ae274cf7c9fee6fbd2ad7 (diff)
downloadyosys-35fa7b30574244e4f99373f2a790f004b4a1dbbb.tar.gz
yosys-35fa7b30574244e4f99373f2a790f004b4a1dbbb.tar.bz2
yosys-35fa7b30574244e4f99373f2a790f004b4a1dbbb.zip
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.
Diffstat (limited to 'passes/opt')
-rw-r--r--passes/opt/opt_rmdff.cc5
1 files changed, 5 insertions, 0 deletions
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;
}