fix(memory): fix segfault error caused by freeing nullptr with Free()
This commit is contained in:
parent
05e62e1381
commit
3efabc342f
@ -127,6 +127,8 @@ void* Realloc(void* Ptr, size_t Count, size_t Alignment)
|
|||||||
|
|
||||||
void Free(void* Ptr)
|
void Free(void* Ptr)
|
||||||
{
|
{
|
||||||
|
if (Ptr == nullptr) return;
|
||||||
|
|
||||||
# if PLATFORM_WINDOWS
|
# if PLATFORM_WINDOWS
|
||||||
{
|
{
|
||||||
_aligned_free(Ptr);
|
_aligned_free(Ptr);
|
||||||
@ -137,7 +139,7 @@ void Free(void* Ptr)
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
check_code({ if (Ptr != nullptr) MemoryLeakChecker.ReleaseMemoryAllocationCount(); });
|
check_code({ MemoryLeakChecker.ReleaseMemoryAllocationCount(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t QuantizeSize(size_t Count, size_t Alignment)
|
size_t QuantizeSize(size_t Count, size_t Alignment)
|
||||||
|
Loading…
Reference in New Issue
Block a user