Drop for-loop temporary at end of scope, fixes memory leak.

This commit is contained in:
Graydon Hoare 2011-02-22 18:07:47 -08:00
parent af4d6ae76b
commit d7f7634c95

View file

@ -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());