diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index 4dfc2e7b3e6a34..6b99c2b583657b 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -3386,6 +3386,9 @@ fn (mut g Gen) autofree_scope_vars2(scope &ast.Scope, start_pos int, end_pos int // Do not free vars that were declared after this scope continue } + if obj.expr is ast.IfGuardExpr { + continue + } g.autofree_variable(obj) } else {}