summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
Diffstat (limited to 'scope.c')
-rw-r--r--scope.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/scope.c b/scope.c
index cc7d7db..5d01c6f 100644
--- a/scope.c
+++ b/scope.c
@@ -23,6 +23,11 @@ static void remove_ident_decls(Block *b, Declaration *d) {
IdentDecl **decls = &id_info->decls;
IdentDecl *last_decl = arr_last(*decls);
if (last_decl && last_decl->scope == b) {
+ if ((last_decl->flags & IDECL_FLAG_HAS_VAL)
+ && last_decl->decl->type.kind == TYPE_ARR) {
+ /* free array on stack */
+ free(last_decl->val.arr);
+ }
arr_remove_last(decls); /* remove that declaration */
}
}