Skip to content

Commit

Permalink
Fix a memory leak when freeing AST_EXPR_ALT nodes
Browse files Browse the repository at this point in the history
Like AST_EXPR_CONCAT nodes, AST_EXPR_ALT nodes consist of two blocks of
memory: the node itself, and the array of children. Free both of them.
  • Loading branch information
hvdijk authored and katef committed Sep 10, 2020
1 parent dd37a3b commit bd59eee
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/libre/ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ ast_expr_free(struct ast_expr *n)
for (i = 0; i < n->u.alt.count; i++) {
ast_expr_free(n->u.alt.n[i]);
}

free(n->u.alt.n);
break;
}

Expand Down

0 comments on commit bd59eee

Please sign in to comment.