-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
A-codegenArea: Code generationArea: Code generation
Description
This will leak the ptr. Valgrind will complain.
use core::libc::{c_void, malloc, free};
struct SmartPtr(*c_void);
impl Drop for SmartPtr {
fn finalize(&self) {
unsafe {
error!("end ptr: %x", **self as uint);
free(**self);
}
}
}
fn main() {
unsafe {
let junk = malloc(4);
error!("start ptr: %x", junk as uint);
let _junkbox = SmartPtr(junk);
}
}
Metadata
Metadata
Assignees
Labels
A-codegenArea: Code generationArea: Code generation