xous: ffi: correct size of freed memory

The amount of memory allocated was multiplied by sizeof::<T>(), so the
amount of memory to be freed should also be multiplied by sizeof::<T>().

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2023-12-24 14:51:28 +08:00
parent dee1c260b8
commit 944dc21268

View file

@ -407,7 +407,7 @@ pub(crate) unsafe fn map_memory<T>(
pub(crate) unsafe fn unmap_memory<T>(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::<T>();
let a3 = 0;
let a4 = 0;
let a5 = 0;