diff options
| author | engineer124 <47598039+engineer124@users.noreply.github.com> | 2023-06-05 05:43:12 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-04 15:43:12 -0400 |
| commit | 47bc7c12e2d28b8d8ed1cff8df9c17395aefce80 (patch) | |
| tree | 7ebf8ec3fc5825c4bbe7cf28717d5abd48ce50ba /src/boot_O2/__osMalloc.c | |
| parent | a995e4cf6181bab778b89d073a2aa67860d82721 (diff) | |
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
Diffstat (limited to 'src/boot_O2/__osMalloc.c')
| -rw-r--r-- | src/boot_O2/__osMalloc.c | 4 |
1 files changed, 2 insertions, 2 deletions
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; } |
