test that environ gets deallocated on changes

This commit is contained in:
Christian Poveda 2020-03-07 09:26:04 -05:00
parent aedc34c6e5
commit 6eccc809f2
No known key found for this signature in database
GPG key ID: 27525EF5E7420A50

View file

@ -0,0 +1,10 @@
extern "C" {
static environ: *const *const u8;
}
fn main() {
let pointer = unsafe { environ };
let _x = unsafe { *pointer };
std::env::set_var("FOO", "BAR");
let _y = unsafe { *pointer }; //~ ERROR dangling pointer was dereferenced
}