From 33df3f31307b920c5b5fbef0a1039d07197ae809 Mon Sep 17 00:00:00 2001
From: Amelia Coutard <eliottulio.coutard@gmail.com>
Date: Thu, 13 Oct 2022 16:45:51 +0200
Subject: [PATCH] Made the physical pages returned by the allocator null, to
 avoid any unexpected bugs. Might change later

---
 src/paging.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/paging.cpp b/src/paging.cpp
index eeef690..302a675 100644
--- a/src/paging.cpp
+++ b/src/paging.cpp
@@ -73,12 +73,18 @@ os::paging::page_allocator_t::block os::paging::page_allocator_t::allocate(std::
 	for (auto it = begin(); it != end(); it = it->next) {
 		if (count == it->size) {
 			erase(it);
+			for (std::size_t i = 0; i < count * 0x1000; i++) {
+				phys_ptr<char>(it.get_phys_addr())[i] = 0;
+			}
 			return {
 				.ptr = phys_ptr<paging::page>(it.get_phys_addr()),
 				.size = count,
 			};
 		} else if (count < it->size) {
 			erase(split_at_offset(it, count));
+			for (std::size_t i = 0; i < count * 0x1000; i++) {
+				phys_ptr<char>(it.get_phys_addr())[i] = 0;
+			}
 			return {
 				.ptr = phys_ptr<paging::page>(it.get_phys_addr()),
 				.size = count,
-- 
2.46.0