[llvm] r224773 - Fix a leak found by asan.

Rafael Espindola rafael.espindola at gmail.com
Tue Dec 23 09:20:23 PST 2014


Author: rafael
Date: Tue Dec 23 11:20:23 2014
New Revision: 224773

URL: http://llvm.org/viewvc/llvm-project?rev=224773&view=rev
Log:
Fix a leak found by asan.

Modified:
    llvm/trunk/unittests/IR/WaymarkTest.cpp

Modified: llvm/trunk/unittests/IR/WaymarkTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/WaymarkTest.cpp?rev=224773&r1=224772&r2=224773&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/WaymarkTest.cpp (original)
+++ llvm/trunk/unittests/IR/WaymarkTest.cpp Tue Dec 23 11:20:23 2014
@@ -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<Function> 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);





More information about the llvm-commits mailing list