r322513 - Fixed memory leak in unit test introduced in my previous commit r322503

Cameron Desrochers via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 15 12:37:35 PST 2018


Author: cameron314
Date: Mon Jan 15 12:37:35 2018
New Revision: 322513

URL: http://llvm.org/viewvc/llvm-project?rev=322513&view=rev
Log:
Fixed memory leak in unit test introduced in my previous commit r322503

Modified:
    cfe/trunk/unittests/libclang/LibclangTest.cpp

Modified: cfe/trunk/unittests/libclang/LibclangTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/libclang/LibclangTest.cpp?rev=322513&r1=322512&r2=322513&view=diff
==============================================================================
--- cfe/trunk/unittests/libclang/LibclangTest.cpp (original)
+++ cfe/trunk/unittests/libclang/LibclangTest.cpp Mon Jan 15 12:37:35 2018
@@ -592,6 +592,9 @@ TEST_F(LibclangReparseTest, Preprocessor
     if (i == 2)
       flags |= CXTranslationUnit_CreatePreambleOnFirstParse;
 
+    if (i != 0)
+       clang_disposeTranslationUnit(ClangTU);  // dispose from previous iter
+
     // parse once
     ClangTU = clang_parseTranslationUnit(Index, Main.c_str(), nullptr, 0,
                                          nullptr, 0, flags);




More information about the cfe-commits mailing list