Skip to content

Commit

Permalink
Fix a memory leak in V3Fork
Browse files Browse the repository at this point in the history
Signed-off-by: Krzysztof Boronski <[email protected]>
  • Loading branch information
kboronski-ant committed Oct 26, 2023
1 parent 34708bb commit 7db4eaf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/V3Fork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,15 @@ class DynScopeVisitor final : public VNVisitor {

if (typesAdded) v3Global.rootp()->typeTablep()->repairCache();
}
~DynScopeVisitor() override = default;
~DynScopeVisitor() override {
std::set<ForkDynScopeFrame*> frames;
for (auto node_frame : m_frames) {
frames.insert(node_frame.second);
}
for (auto* frame : frames) {
delete frame;
}
}
};

//######################################################################
Expand Down

0 comments on commit 7db4eaf

Please sign in to comment.