mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Check for pointers
This commit is contained in:
parent
045592d8e6
commit
cfb69bf15a
@ -281,6 +281,12 @@ void *HeapCalloc(size_t n, size_t Size)
|
|||||||
|
|
||||||
void *HeapRealloc(void *Address, size_t Size)
|
void *HeapRealloc(void *Address, size_t Size)
|
||||||
{
|
{
|
||||||
|
if (unlikely(!Address))
|
||||||
|
{
|
||||||
|
error("Attempt to realloc a null pointer");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
switch (AllocatorType)
|
switch (AllocatorType)
|
||||||
{
|
{
|
||||||
case unlikely(MemoryAllocatorType::Pages):
|
case unlikely(MemoryAllocatorType::Pages):
|
||||||
@ -304,6 +310,12 @@ void *HeapRealloc(void *Address, size_t Size)
|
|||||||
|
|
||||||
void HeapFree(void *Address)
|
void HeapFree(void *Address)
|
||||||
{
|
{
|
||||||
|
if (unlikely(!Address))
|
||||||
|
{
|
||||||
|
warn("Attempt to free a null pointer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (AllocatorType)
|
switch (AllocatorType)
|
||||||
{
|
{
|
||||||
case unlikely(MemoryAllocatorType::Pages):
|
case unlikely(MemoryAllocatorType::Pages):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user