fix memory leak on error

This commit is contained in:
r4
2021-12-21 14:04:50 +01:00
parent 005309d1eb
commit 61d5661b96
2 changed files with 3 additions and 1 deletions

View File

@@ -371,7 +371,7 @@ IRToks parse(TokList *toks) {
for (;;) {
if (toks->begin->tok.kind == TokOp && toks->begin->tok.Op == OpEOF)
break;
TRY_RET(stmt(&s, &global_scope, toks->begin), ir);
TRY_RET_ELSE(stmt(&s, &global_scope, toks->begin), ir, term_scope(&global_scope));
}
term_scope(&global_scope);
return ir;