Skip to content

Commit 944dc21

Browse files
committed
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>
1 parent dee1c26 commit 944dc21

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/std/src/os/xous/ffi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ pub(crate) unsafe fn map_memory<T>(
407407
pub(crate) unsafe fn unmap_memory<T>(range: *mut [T]) -> Result<(), Error> {
408408
let mut a0 = Syscall::UnmapMemory as usize;
409409
let mut a1 = range.as_mut_ptr() as usize;
410-
let a2 = range.len();
410+
let a2 = range.len() * core::mem::size_of::<T>();
411411
let a3 = 0;
412412
let a4 = 0;
413413
let a5 = 0;

0 commit comments

Comments
 (0)