summaryrefslogtreecommitdiff
path: root/userland
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2023-10-30 21:43:17 +0100
committerAnton Kling <anton@kling.gg>2023-10-30 21:49:48 +0100
commitfdb75cf832af77c0d93e0adb514c30964c6b680f (patch)
tree3a42ca71d791fa33b79475372e510e7ec59ef095 /userland
parentecf1e4c6c6efc3edeb006ff120ac60a191ddce50 (diff)
LibC: Don't fail if a free() is done that the wrong address location.
Diffstat (limited to 'userland')
-rw-r--r--userland/libc/malloc/malloc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/userland/libc/malloc/malloc.c b/userland/libc/malloc/malloc.c
index f351291..5c2fe98 100644
--- a/userland/libc/malloc/malloc.c
+++ b/userland/libc/malloc/malloc.c
@@ -220,9 +220,12 @@ void free(void *p) {
// Is this a assumption that can be made?
MallocHeader *h = (MallocHeader *)((uint32_t)p - sizeof(MallocHeader));
if (MALLOC_HEADER_MAGIC != h->magic) {
+#ifdef LIBC_DEBUG
+ printf("LibC Malloc: free() is attempted at the incorrect location or at a corrupted header.\n");
printf("h->magic: %x\n", h->magic);
printf("&h->magic: %x\n", &(h->magic));
- assert(0);
+#endif
+ return;
}
if (h->flags & IS_FREE)
return;