summaryrefslogtreecommitdiff
path: root/ast.c
diff options
context:
space:
mode:
Diffstat (limited to 'ast.c')
-rw-r--r--ast.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ast.c b/ast.c
index 9fa4f82..c491c42 100644
--- a/ast.c
+++ b/ast.c
@@ -65,7 +65,10 @@ static void fn_decl_destroy(struct fn_decl_node* node) {
free(node->args);
}
- group_destroy(&node->body);
+ if (node->body != NULL) {
+ group_destroy(node->body);
+ free(node->body);
+ }
scope_destroy(node->scope);
free(node->scope);