null check for delete override
Former-commit-id: 51216ee433d606644f3c2953abb97753b2eae079
This commit is contained in:
parent
6b8e55ce06
commit
c48a942ce4
@ -27,14 +27,17 @@ void *operator new(std::size_t size, const std::nothrow_t &) noexcept
|
|||||||
return zmalloc(size, MALLOC_LOCAL);
|
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
|
void operator delete(void * p) noexcept
|
||||||
{
|
{
|
||||||
zfree(p);
|
if (p != nullptr)
|
||||||
|
zfree(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator delete(void *p, std::size_t) noexcept
|
void operator delete(void *p, std::size_t) noexcept
|
||||||
{
|
{
|
||||||
zfree(p);
|
if (p != nullptr)
|
||||||
|
zfree(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user