rustc: Zero out unique pointers after we drop them
This commit is contained in:
parent
477c1bf6e1
commit
07691e725a
2 changed files with 7 additions and 1 deletions
|
@ -1386,7 +1386,12 @@ fn make_drop_glue(bcx: &@block_ctxt, v0: ValueRef, t: ty::t) {
|
||||||
ty::ty_vec(_) { tvec::make_drop_glue(bcx, v0, t) }
|
ty::ty_vec(_) { tvec::make_drop_glue(bcx, v0, t) }
|
||||||
ty::ty_istr. { tvec::make_drop_glue(bcx, v0, t) }
|
ty::ty_istr. { tvec::make_drop_glue(bcx, v0, t) }
|
||||||
ty::ty_box(_) { decr_refcnt_maybe_free(bcx, v0, v0, t) }
|
ty::ty_box(_) { decr_refcnt_maybe_free(bcx, v0, v0, t) }
|
||||||
ty::ty_uniq(_) { trans_shared_free(bcx, Load(bcx, v0)) }
|
ty::ty_uniq(_) {
|
||||||
|
let vptr = Load(bcx, v0);
|
||||||
|
let bcx = trans_shared_free(bcx, vptr);
|
||||||
|
Store(bcx, C_null(val_ty(vptr)), v0);
|
||||||
|
bcx
|
||||||
|
}
|
||||||
ty::ty_obj(_) {
|
ty::ty_obj(_) {
|
||||||
let box_cell =
|
let box_cell =
|
||||||
GEP(bcx, v0, [C_int(0), C_int(abi::obj_field_box)]);
|
GEP(bcx, v0, [C_int(0), C_int(abi::obj_field_box)]);
|
||||||
|
|
|
@ -87,6 +87,7 @@ fn make_drop_glue(bcx: &@block_ctxt, vptrptr: ValueRef, vec_ty: ty::t)
|
||||||
drop_cx = iter_vec(drop_cx, vptrptr, vec_ty, trans::drop_ty);
|
drop_cx = iter_vec(drop_cx, vptrptr, vec_ty, trans::drop_ty);
|
||||||
}
|
}
|
||||||
drop_cx = trans::trans_shared_free(drop_cx, vptr);
|
drop_cx = trans::trans_shared_free(drop_cx, vptr);
|
||||||
|
Store(drop_cx, C_null(val_ty(vptr)), vptrptr);
|
||||||
Br(drop_cx, next_cx.llbb);
|
Br(drop_cx, next_cx.llbb);
|
||||||
ret next_cx;
|
ret next_cx;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue