From 944dc212685a4f17db144d14459ee4bc3ffd3423 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Sun, 24 Dec 2023 14:51:28 +0800 Subject: [PATCH] xous: ffi: correct size of freed memory The amount of memory allocated was multiplied by sizeof::(), so the amount of memory to be freed should also be multiplied by sizeof::(). Signed-off-by: Sean Cross --- library/std/src/os/xous/ffi.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/os/xous/ffi.rs b/library/std/src/os/xous/ffi.rs index 0a7f9a10d4d..1df4fbab7f7 100644 --- a/library/std/src/os/xous/ffi.rs +++ b/library/std/src/os/xous/ffi.rs @@ -407,7 +407,7 @@ pub(crate) unsafe fn map_memory( pub(crate) unsafe fn unmap_memory(range: *mut [T]) -> Result<(), Error> { let mut a0 = Syscall::UnmapMemory as usize; let mut a1 = range.as_mut_ptr() as usize; - let a2 = range.len(); + let a2 = range.len() * core::mem::size_of::(); let a3 = 0; let a4 = 0; let a5 = 0;