[Lldb-commits] [PATCH] D42386: Fix memory leak in TestClangASTContext.TestRecordHasFields

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 22 10:58:17 PST 2018


teemperor created this revision.

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


https://reviews.llvm.org/D42386

Files:
  unittests/Symbol/TestClangASTContext.cpp


Index: unittests/Symbol/TestClangASTContext.cpp
===================================================================
--- unittests/Symbol/TestClangASTContext.cpp
+++ unittests/Symbol/TestClangASTContext.cpp
@@ -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 @@
                    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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42386.130926.patch
Type: text/x-patch
Size: 702 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180122/83db1ecb/attachment.bin>


More information about the lldb-commits mailing list