diff --git a/kernel/src/allocator.rs b/kernel/src/allocator.rs index 5329844..bd225bf 100644 --- a/kernel/src/allocator.rs +++ b/kernel/src/allocator.rs @@ -150,7 +150,8 @@ impl Heap { #[cfg(debug_assertions)] trace!("Allocating {:?}", ptr); } - // FIXME: zero out memory to prevent leaking data + + unsafe { core::ptr::write_bytes(ptr, 0, size) }; assert!(ptr.is_aligned_to(alignment)); NonNull::new(ptr) @@ -168,6 +169,7 @@ impl Heap { self.bitmap_set_range(start, size, false); self.allocated_chunks -= size; // FIXME: zero out memory to prevent leaking data + // REPLY: When we zero on alloc, do we really need it? } /// Finds first hole that can fit an allocation of `size` chunks, returns the start of the