r260850 - Don't leak the ASTUnit when done with testing.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 14 05:18:07 PST 2016


Author: d0k
Date: Sun Feb 14 07:18:06 2016
New Revision: 260850

URL: http://llvm.org/viewvc/llvm-project?rev=260850&view=rev
Log:
Don't leak the ASTUnit when done with testing.

Found by lsan.

Modified:
    cfe/trunk/tools/c-index-test/core_main.cpp

Modified: cfe/trunk/tools/c-index-test/core_main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/core_main.cpp?rev=260850&r1=260849&r2=260850&view=diff
==============================================================================
--- cfe/trunk/tools/c-index-test/core_main.cpp (original)
+++ cfe/trunk/tools/c-index-test/core_main.cpp Sun Feb 14 07:18:06 2016
@@ -123,9 +123,8 @@ static bool printSourceSymbols(ArrayRef<
                                      /*WrappedAction=*/nullptr);
 
   auto PCHContainerOps = std::make_shared<PCHContainerOperations>();
-  ASTUnit *Unit =
-   ASTUnit::LoadFromCompilerInvocationAction(CInvok.get(), PCHContainerOps,
-                                             Diags, IndexAction.get());
+  std::unique_ptr<ASTUnit> Unit(ASTUnit::LoadFromCompilerInvocationAction(
+      CInvok.get(), PCHContainerOps, Diags, IndexAction.get()));
 
   if (!Unit)
     return true;




More information about the cfe-commits mailing list