null check for delete override

Former-commit-id: f5f2f5e200a5ff1b0306998624b758d5a4c10825
This commit is contained in:
malavan 2021-10-21 23:50:50 +00:00
parent 3f08905408
commit fbe9ff6680

View File

@ -27,14 +27,17 @@ void *operator new(std::size_t size, const std::nothrow_t &) noexcept
return zmalloc(size, MALLOC_LOCAL);
}
//need to do null checks for delete since the compiler can optimize out null checks in zfree
void operator delete(void * p) noexcept
{
zfree(p);
if (p != nullptr)
zfree(p);
}
void operator delete(void *p, std::size_t) noexcept
{
zfree(p);
if (p != nullptr)
zfree(p);
}
#endif