summaryrefslogtreecommitdiff
path: root/libcxx
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
commit4d4f2e962d9a61f39893b01223b566d8f3ce98ed (patch)
tree209c613589fa8858fa71c6dc86121f0e0315893b /libcxx
parent8f5ea87f4e4ed2889e06499887cc4bcfa945f974 (diff)
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++.
Diffstat (limited to 'libcxx')
-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
}