about summary refs log tree commit diff
path: root/src/tools/miri/tests/fail/alloc/deallocate-twice.rs
blob: 340ca1f75ef9081c768f4e786e8eb1bd54952ff7 (plain)
1
2
3
4
5
6
7
8
9
use std::alloc::{Layout, alloc, dealloc};

fn main() {
    unsafe {
        let x = alloc(Layout::from_size_align_unchecked(1, 1));
        dealloc(x, Layout::from_size_align_unchecked(1, 1));
        dealloc(x, Layout::from_size_align_unchecked(1, 1)); //~ERROR: has been freed
    }
}