summaryrefslogtreecommitdiff
path: root/kernel/kmalloc.c
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-04-02 09:17:06 +0200
committerAnton Kling <anton@kling.gg>2024-04-02 09:39:03 +0200
commit2229fd91f7230ae7068814ae029b733945852eb1 (patch)
tree416487f8c66c389c57dee465f648362ca59b8f23 /kernel/kmalloc.c
parent7eceb43433634ee253507208baf1d8298b40e377 (diff)
Kernel: Fix some memory leaks
Diffstat (limited to 'kernel/kmalloc.c')
-rw-r--r--kernel/kmalloc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/kernel/kmalloc.c b/kernel/kmalloc.c
index c88ea8f..7138d61 100644
--- a/kernel/kmalloc.c
+++ b/kernel/kmalloc.c
@@ -231,9 +231,8 @@ void kfree(void *p) {
// Could this be avoided in a simple way?
MallocHeader *h = (MallocHeader *)((uintptr_t)p - sizeof(MallocHeader));
assert(h->magic == 0xdde51ab9410268b1);
- if (h->flags & IS_FREE) {
- return;
- }
+ assert(!(h->flags & IS_FREE));
+
get_fast_insecure_random((void *)p, h->size);
h->flags |= IS_FREE;