From 7db4eaf9a5914000560dc68148f1de8714e36a44 Mon Sep 17 00:00:00 2001 From: Krzysztof Boronski Date: Thu, 26 Oct 2023 16:32:44 +0200 Subject: [PATCH] Fix a memory leak in V3Fork Signed-off-by: Krzysztof Boronski --- src/V3Fork.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/V3Fork.cpp b/src/V3Fork.cpp index 098104d111..bd52f90a1c 100644 --- a/src/V3Fork.cpp +++ b/src/V3Fork.cpp @@ -441,7 +441,15 @@ class DynScopeVisitor final : public VNVisitor { if (typesAdded) v3Global.rootp()->typeTablep()->repairCache(); } - ~DynScopeVisitor() override = default; + ~DynScopeVisitor() override { + std::set frames; + for (auto node_frame : m_frames) { + frames.insert(node_frame.second); + } + for (auto* frame : frames) { + delete frame; + } + } }; //######################################################################