Fix TOK_ID memory leak in for_initialization
authorZachary Snow <zach@zachjs.com>
Thu, 23 Sep 2021 17:33:55 +0000 (13:33 -0400)
committerZachary Snow <zach@zachjs.com>
Thu, 23 Sep 2021 17:33:55 +0000 (13:33 -0400)
frontends/verilog/verilog_parser.y

index 8d0ba4cf67a9dd1e2f7d751df8375ce63c76df59..acb8b996c0885dd903ed6aef8a4c47cdc11eec02 100644 (file)
@@ -2674,6 +2674,7 @@ for_initialization:
                AstNode *node = new AstNode(AST_ASSIGN_EQ, ident, $3);
                ast_stack.back()->children.push_back(node);
                SET_AST_NODE_LOC(node, @1, @3);
+               delete $1;
        } |
        non_io_wire_type range TOK_ID {
                frontend_verilog_yyerror("For loop variable declaration is missing initialization!");