Revert r342936 "Remove redundant null pointer check in operator delete"

A review for the change was opened in https://reviews.llvm.org/D52401
but the change was committed before being approved by any of the code
owners for libc++.

llvm-svn: 342938
This commit is contained in:
Louis Dionne 2018-09-25 04:13:08 +00:00
parent 12da0f9c3d
commit 3c3e1c6265
1 changed files with 5 additions and 3 deletions

View File

@ -135,7 +135,8 @@ _LIBCPP_WEAK
void
operator delete(void* ptr) _NOEXCEPT
{
::free(ptr);
if (ptr)
::free(ptr);
}
_LIBCPP_WEAK
@ -256,10 +257,11 @@ _LIBCPP_WEAK
void
operator delete(void* ptr, std::align_val_t) _NOEXCEPT
{
if (ptr)
#if defined(_LIBCPP_MSVCRT_LIKE)
::_aligned_free(ptr);
::_aligned_free(ptr);
#else
::free(ptr);
::free(ptr);
#endif
}