From 1871cba561f97f67d309e5fc96470c69c763dcc5 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 23 Dec 2014 17:20:23 +0000 Subject: [PATCH] Fix a leak found by asan. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224773 91177308-0d34-0410-b5e6-96231b3b80d8 --- unittests/IR/WaymarkTest.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/unittests/IR/WaymarkTest.cpp b/unittests/IR/WaymarkTest.cpp index 8e3cd45808f..a8924efed3f 100644 --- a/unittests/IR/WaymarkTest.cpp +++ b/unittests/IR/WaymarkTest.cpp @@ -29,8 +29,9 @@ TEST(WaymarkTest, NativeArray) { Value * values[22]; std::transform(tail, tail + 22, values, char2constant); FunctionType *FT = FunctionType::get(Type::getVoidTy(getGlobalContext()), true); - Function *F = Function::Create(FT, GlobalValue::ExternalLinkage); - const CallInst *A = CallInst::Create(F, makeArrayRef(values)); + std::unique_ptr F( + Function::Create(FT, GlobalValue::ExternalLinkage)); + const CallInst *A = CallInst::Create(F.get(), makeArrayRef(values)); ASSERT_NE(A, (const CallInst*)nullptr); ASSERT_EQ(1U + 22, A->getNumOperands()); const Use *U = &A->getOperandUse(0); -- 2.40.0