Drop for-loop temporary at end of scope, fixes memory leak.
This commit is contained in:
parent
af4d6ae76b
commit
d7f7634c95
1 changed files with 1 additions and 0 deletions
|
@ -2189,6 +2189,7 @@ fn trans_for(@block_ctxt cx,
|
|||
cx.build.Br(scope_cx.llbb);
|
||||
auto local_res = alloc_local(scope_cx, local);
|
||||
auto bcx = copy_ty(local_res.bcx, INIT, local_res.val, curr, t).bcx;
|
||||
scope_cx.cleanups += clean(bind drop_slot(_, local_res.val, t));
|
||||
bcx = trans_block(bcx, body).bcx;
|
||||
bcx.build.Br(next_cx.llbb);
|
||||
ret res(next_cx, C_nil());
|
||||
|
|
Loading…
Reference in a new issue