[Lldb-commits] [lldb] r323138 - Fix memory leak in TestClangASTContext.TestRecordHasFields

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 22 10:56:33 PST 2018


Author: teemperor
Date: Mon Jan 22 10:56:33 2018
New Revision: 323138

URL: http://llvm.org/viewvc/llvm-project?rev=323138&view=rev
Log:
Fix memory leak in TestClangASTContext.TestRecordHasFields

Summary: We can't use unique_ptr's here because we use those variables as `out` parameters to some functions. Discovered by the memory sanitizer.

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D42386

Modified:
    lldb/trunk/unittests/Symbol/TestClangASTContext.cpp

Modified: lldb/trunk/unittests/Symbol/TestClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Symbol/TestClangASTContext.cpp?rev=323138&r1=323137&r2=323138&view=diff
==============================================================================
--- lldb/trunk/unittests/Symbol/TestClangASTContext.cpp (original)
+++ lldb/trunk/unittests/Symbol/TestClangASTContext.cpp Mon Jan 22 10:56:33 2018
@@ -11,6 +11,8 @@
 
 #include "gtest/gtest.h"
 
+#include "clang/AST/DeclCXX.h"
+
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/ClangUtil.h"
@@ -375,6 +377,9 @@ TEST_F(TestClangASTContext, TestRecordHa
                    empty_derived_non_empty_vbase_cxx_decl, false));
   EXPECT_TRUE(
       ClangASTContext::RecordHasFields(empty_derived_non_empty_vbase_decl));
+
+  delete non_empty_base_spec;
+  delete non_empty_vbase_spec;
 }
 
 TEST_F(TestClangASTContext, TemplateArguments) {




More information about the lldb-commits mailing list