Fixed memory leak.
authorMaciej Kurc <mkurc@antmicro.com>
Wed, 5 Jun 2019 08:42:43 +0000 (10:42 +0200)
committerMaciej Kurc <mkurc@antmicro.com>
Wed, 5 Jun 2019 08:42:43 +0000 (10:42 +0200)
Signed-off-by: Maciej Kurc <mkurc@antmicro.com>
frontends/verilog/verilog_parser.y

index 82a1d9d39ef333fd5530f0733e8672812e4558a5..ccdab987fe5915b8f08edb6b9fb45be761244c34 100644 (file)
@@ -1535,11 +1535,13 @@ cell_port:
        attr {
                AstNode *node = new AstNode(AST_ARGUMENT);
                astbuf2->children.push_back(node);
+               free_attr($1);
        } |
        attr expr {
                AstNode *node = new AstNode(AST_ARGUMENT);
                astbuf2->children.push_back(node);
                node->children.push_back($2);
+               free_attr($1);
        } |
        attr '.' TOK_ID '(' expr ')' {
                AstNode *node = new AstNode(AST_ARGUMENT);
@@ -1547,12 +1549,14 @@ cell_port:
                astbuf2->children.push_back(node);
                node->children.push_back($5);
                delete $3;
+               free_attr($1);
        } |
        attr '.' TOK_ID '(' ')' {
                AstNode *node = new AstNode(AST_ARGUMENT);
                node->str = *$3;
                astbuf2->children.push_back(node);
                delete $3;
+               free_attr($1);
        };
 
 always_stmt: