mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-14 21:16:50 +00:00
commit
3f2c9ee17e
@ -1 +1 @@
|
||||
c7a30c8b6860d1f3459086f7a91074db1b54bc37
|
||||
db062de72b0a064f45b6f86894cbdc7c0ec68844
|
||||
|
@ -5,6 +5,6 @@ use std::alloc::{alloc, realloc, Layout};
|
||||
fn main() {
|
||||
unsafe {
|
||||
let x = alloc(Layout::from_size_align_unchecked(1, 1));
|
||||
realloc(x, Layout::from_size_align_unchecked(2, 1), 1);
|
||||
let _y = realloc(x, Layout::from_size_align_unchecked(2, 1), 1);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ use std::alloc::{alloc, realloc, Layout};
|
||||
fn main() {
|
||||
unsafe {
|
||||
let x = alloc(Layout::from_size_align_unchecked(1, 1));
|
||||
realloc(x, Layout::from_size_align_unchecked(1, 1), 1);
|
||||
let _y = realloc(x, Layout::from_size_align_unchecked(1, 1), 1);
|
||||
let _z = *x; //~ ERROR dereferenced after this allocation got freed
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,6 @@ fn main() {
|
||||
unsafe {
|
||||
let x = alloc(Layout::from_size_align_unchecked(1, 1));
|
||||
dealloc(x, Layout::from_size_align_unchecked(1, 1));
|
||||
realloc(x, Layout::from_size_align_unchecked(1, 1), 1);
|
||||
let _z = realloc(x, Layout::from_size_align_unchecked(1, 1), 1);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user