mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 17:53:56 +00:00
20 lines
291 B
Rust
20 lines
291 B
Rust
// needs-sanitizer-support
|
|
// needs-sanitizer-address
|
|
//
|
|
// compile-flags: -Z sanitizer=address -O
|
|
//
|
|
// run-fail
|
|
// error-pattern: AddressSanitizer: SEGV
|
|
|
|
use std::ffi::c_void;
|
|
|
|
extern "C" {
|
|
fn free(ptr: *mut c_void);
|
|
}
|
|
|
|
fn main() {
|
|
unsafe {
|
|
free(1 as *mut c_void);
|
|
}
|
|
}
|