[libcxx] r342938 - Revert r342936 "Remove redundant null pointer check in operator delete"
Louis Dionne
ldionne at apple.com
Mon Sep 24 21:13:08 PDT 2018
Author: ldionne
Date: Mon Sep 24 21:13:08 2018
New Revision: 342938
URL: http://llvm.org/viewvc/llvm-project?rev=342938&view=rev
Log:
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++.
Modified:
libcxx/trunk/src/new.cpp
Modified: libcxx/trunk/src/new.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/new.cpp?rev=342938&r1=342937&r2=342938&view=diff
==============================================================================
--- libcxx/trunk/src/new.cpp (original)
+++ libcxx/trunk/src/new.cpp Mon Sep 24 21:13:08 2018
@@ -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
}
More information about the libcxx-commits
mailing list