From 47bc7c12e2d28b8d8ed1cff8df9c17395aefce80 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Mon, 5 Jun 2023 05:43:12 +1000 Subject: Misc Cleanup (#1257) * a lot of brackets, and some other things * oops * another bracket * check flag all * just a few more... * PR suggestions * PR comment * pr * one more bracket --- src/boot_O2/__osMalloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/boot_O2/__osMalloc.c') diff --git a/src/boot_O2/__osMalloc.c b/src/boot_O2/__osMalloc.c index 24fa6d39e..71a5a5ba3 100644 --- a/src/boot_O2/__osMalloc.c +++ b/src/boot_O2/__osMalloc.c @@ -275,7 +275,7 @@ void __osFree(Arena* arena, void* ptr) { node = (ArenaNode*)((uintptr_t)ptr - sizeof(ArenaNode)); - if (ptr != NULL && node->magic == NODE_MAGIC && !node->isFree) { + if ((ptr != NULL) && (node->magic == NODE_MAGIC) && !node->isFree) { next = node->next; prev = node->prev; node->isFree = true; @@ -297,7 +297,7 @@ void __osFree(Arena* arena, void* ptr) { // Checks if the previous node is contiguous to the current node and if it isn't currently allocated. Then merge // the two nodes into one. - if (prev != NULL && prev->isFree && (uintptr_t)node == (uintptr_t)prev + sizeof(ArenaNode) + prev->size) { + if ((prev != NULL) && prev->isFree && ((uintptr_t)node == (uintptr_t)prev + sizeof(ArenaNode) + prev->size)) { if (next != NULL) { next->prev = prev; } -- cgit v1.2.3