Skip to content

Commit d7f7634

Browse files
committed
Drop for-loop temporary at end of scope, fixes memory leak.
1 parent af4d6ae commit d7f7634

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/comp/middle/trans.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2189,6 +2189,7 @@ fn trans_for(@block_ctxt cx,
21892189
cx.build.Br(scope_cx.llbb);
21902190
auto local_res = alloc_local(scope_cx, local);
21912191
auto bcx = copy_ty(local_res.bcx, INIT, local_res.val, curr, t).bcx;
2192+
scope_cx.cleanups += clean(bind drop_slot(_, local_res.val, t));
21922193
bcx = trans_block(bcx, body).bcx;
21932194
bcx.build.Br(next_cx.llbb);
21942195
ret res(next_cx, C_nil());

0 commit comments

Comments
 (0)