summaryrefslogtreecommitdiff
path: root/src/tools/miri/tests/fail/alloc/reallocate-dangling.rs
blob: 130e2a8301e1c542b5517b668785d2cae3ad9f1a (plain)
1
2
3
4
5
6
7
8
9
10
11
use std::alloc::{alloc, dealloc, realloc, Layout};

//@error-in-other-file: dereferenced after this allocation got freed

fn main() {
    unsafe {
        let x = alloc(Layout::from_size_align_unchecked(1, 1));
        dealloc(x, Layout::from_size_align_unchecked(1, 1));
        let _z = realloc(x, Layout::from_size_align_unchecked(1, 1), 1);
    }
}