From fdefac8599a385a87de02f06d5a77f726a524904 Mon Sep 17 00:00:00 2001 From: Tim Diekmann Date: Mon, 8 Apr 2019 01:26:52 +0200 Subject: [PATCH] Fix calloc test Forgot to free the memory. Miri found the bug :) --- tests/run-pass/calloc.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/run-pass/calloc.rs b/tests/run-pass/calloc.rs index 8e8e2e5f10f..4c520da85e8 100644 --- a/tests/run-pass/calloc.rs +++ b/tests/run-pass/calloc.rs @@ -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); } } -- 2.44.0