Fix calloc test

Forgot to free the memory. Miri found the bug :)
This commit is contained in:
Tim Diekmann 2019-04-08 01:26:52 +02:00
parent fa0755c9fd
commit fdefac8599
No known key found for this signature in database
GPG key ID: 58CD76F88DF563E0

View file

@ -17,10 +17,10 @@ fn main() {
let p3 = libc::calloc(0, 20);
assert!(p3.is_null());
let p4 = libc::calloc(4, 8) as *const u8;
let p4 = libc::calloc(4, 8);
assert!(!p4.is_null());
let slice = slice::from_raw_parts(p4, 4 * 8);
let slice = slice::from_raw_parts(p4 as *const u8, 4 * 8);
assert_eq!(&slice, &[0_u8; 4 * 8]);
libc::free(p4);
}
}