fix(allocator): added error check to malloc function
This commit is contained in:
parent
1e653f67c7
commit
3aabf00607
1 changed files with 4 additions and 0 deletions
|
|
@ -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);
|
memory_pointer = (HallocyMemoryHeader*)mmap(NULL, aligned_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (memory_pointer == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
memory_pointer->size = aligned_size;
|
memory_pointer->size = aligned_size;
|
||||||
memory_pointer->next = NULL;
|
memory_pointer->next = NULL;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue