From 3aabf00607c9651905f7c4feb22317997239d417 Mon Sep 17 00:00:00 2001 From: Mineplay Date: Fri, 11 Apr 2025 17:31:15 -0500 Subject: [PATCH] fix(allocator): added error check to malloc function --- Src/Hallocy/Allocator.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Src/Hallocy/Allocator.c b/Src/Hallocy/Allocator.c index 6d56c05..1f96cb9 100644 --- a/Src/Hallocy/Allocator.c +++ b/Src/Hallocy/Allocator.c @@ -56,6 +56,10 @@ void *hallocy_malloc(size_t size) { memory_pointer = (HallocyMemoryHeader*)mmap(NULL, aligned_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); #endif + if (memory_pointer == NULL) { + return NULL; + } + memory_pointer->size = aligned_size; memory_pointer->next = NULL;