summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-12-21 19:09:01 +0000
committerKostya Serebryany <kcc@google.com>2015-12-21 19:09:01 +0000
commit9fc3869acde3a67528cd87f5ead02b5b8eccbd0a (patch)
treecb00bbdcb2a5f1301b42a70789a67344c2104d6f
parent15368636686ba54560244bb08ece60f1c4ad2ab0 (diff)
fix leak in a test, make the sanitizer bot green
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256179 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--unittests/Support/TrailingObjectsTest.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/unittests/Support/TrailingObjectsTest.cpp b/unittests/Support/TrailingObjectsTest.cpp
index 2b8ab4c5fb8..4c05d665f98 100644
--- a/unittests/Support/TrailingObjectsTest.cpp
+++ b/unittests/Support/TrailingObjectsTest.cpp
@@ -164,7 +164,8 @@ TEST(TrailingObjects, ThreeArg) {
sizeof(double) + sizeof(short) + 3 * sizeof(bool));
EXPECT_EQ(sizeof(Class3),
llvm::RoundUpToAlignment(1, llvm::alignOf<double>()));
- Class3 *C = reinterpret_cast<Class3 *>(::operator new(1000));
+ std::unique_ptr<char[]> P(new char[1000]);
+ Class3 *C = reinterpret_cast<Class3 *>(P.get());
EXPECT_EQ(C->getTrailingObjects<double>(), reinterpret_cast<double *>(C + 1));
EXPECT_EQ(C->getTrailingObjects<short>(),
reinterpret_cast<short *>(reinterpret_cast<double *>(C + 1) + 1));