From bdc2597f792a602ec22f98d7cb3fc23710b6659a Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Fri, 25 Apr 2025 01:00:08 +0200 Subject: [PATCH] simplify: fix struct wiretype attr memory leak --- frontends/ast/simplify.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index d35756d4e..3411d6c03 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -1919,6 +1919,8 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin if (!str.empty() && str[0] == '\\' && (template_node->type == AST_STRUCT || template_node->type == AST_UNION)) { // replace instance with wire representing the packed structure newNode = make_packed_struct(template_node, str, attributes); + if (newNode->attributes.count(ID::wiretype)) + delete newNode->attributes[ID::wiretype]; newNode->set_attribute(ID::wiretype, mkconst_str(resolved_type_node->str)); // add original input/output attribute to resolved wire newNode->is_input = this->is_input;