summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Dionne <ldionne@apple.com>2018-09-25 04:13:08 +0000
committerLouis Dionne <ldionne@apple.com>2018-09-25 04:13:08 +0000
commit3c3e1c62650abb8692b43ba96b0f252418bc5057 (patch)
tree4349e161c724c8ccfb3522dbe4a57d267e2d3873
parent12da0f9c3d9a5a1ec91f339f45c99dd8f27eb869 (diff)
downloadbcm5719-llvm-3c3e1c62650abb8692b43ba96b0f252418bc5057.tar.gz
bcm5719-llvm-3c3e1c62650abb8692b43ba96b0f252418bc5057.zip
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
-rw-r--r--libcxx/src/new.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/libcxx/src/new.cpp b/libcxx/src/new.cpp
index 35f481db08a..8013d89ae3c 100644
--- a/libcxx/src/new.cpp
+++ b/libcxx/src/new.cpp
@@ -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
}
OpenPOWER on IntegriCloud