mirror of
https://github.com/The-OpenROAD-Project/OpenSTA.git
synced 2026-09-05 00:52:25 +02:00
fix makeConcreteParasitics leak+testcase (#439)
* fix makeConcreteParasitics leak Signed-off-by: dsengupta0628 <[email protected]> * simplify test, update the address review comment Signed-off-by: dsengupta0628 <[email protected]> * reduce test verbosity Signed-off-by: dsengupta0628 <[email protected]> --------- Signed-off-by: dsengupta0628 <[email protected]>
This commit is contained in:
+8
-1
@@ -4291,8 +4291,15 @@ Parasitics *
|
||||
Sta::makeConcreteParasitics(std::string_view name,
|
||||
std::string_view filename)
|
||||
{
|
||||
// Free the prior entry to avoid leaking it on overwrite.
|
||||
std::string key(name);
|
||||
auto it = parasitics_name_map_.find(key);
|
||||
if (it != parasitics_name_map_.end()) {
|
||||
delete it->second;
|
||||
parasitics_name_map_.erase(it);
|
||||
}
|
||||
Parasitics *parasitics = new ConcreteParasitics(name, filename, this);
|
||||
parasitics_name_map_[std::string(name)] = parasitics;
|
||||
parasitics_name_map_[key] = parasitics;
|
||||
return parasitics;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# Sta::makeConcreteParasitics map-overwrite leak repro.
|
||||
# Run under -fsanitize=address to verify no leak after the fix.
|
||||
read_liberty asap7_small.lib.gz
|
||||
read_verilog reg1_asap7.v
|
||||
link_design top
|
||||
# 1st read_spef
|
||||
read_spef -min reg1_asap7.spef
|
||||
# 2nd read_spef
|
||||
read_spef -min reg1_asap7.spef
|
||||
@@ -154,6 +154,7 @@ record_public_tests {
|
||||
liberty_ccsn
|
||||
liberty_float_as_str
|
||||
liberty_latch3
|
||||
make_concrete_parasitics_leak
|
||||
package_require
|
||||
path_group_names
|
||||
power_json
|
||||
|
||||
Reference in New Issue
Block a user