[Lldb-commits] [lldb] r323076 - Fix memory leaks in TestArm64InstEmulation

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Sun Jan 21 23:22:13 PST 2018


Author: teemperor
Date: Sun Jan 21 23:22:13 2018
New Revision: 323076

URL: http://llvm.org/viewvc/llvm-project?rev=323076&view=rev
Log:
Fix memory leaks in TestArm64InstEmulation

Summary: We never delete the created instances, so those test fail with the memory sanitizer.

Reviewers: jasonmolenda

Reviewed By: jasonmolenda

Subscribers: aemerson, javed.absar, kristof.beyls, lldb-commits

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

Modified:
    lldb/trunk/unittests/UnwindAssembly/InstEmulation/TestArm64InstEmulation.cpp

Modified: lldb/trunk/unittests/UnwindAssembly/InstEmulation/TestArm64InstEmulation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/UnwindAssembly/InstEmulation/TestArm64InstEmulation.cpp?rev=323076&r1=323075&r2=323076&view=diff
==============================================================================
--- lldb/trunk/unittests/UnwindAssembly/InstEmulation/TestArm64InstEmulation.cpp (original)
+++ lldb/trunk/unittests/UnwindAssembly/InstEmulation/TestArm64InstEmulation.cpp Sun Jan 21 23:22:13 2018
@@ -56,9 +56,9 @@ void TestArm64InstEmulation::TearDownTes
 
 TEST_F(TestArm64InstEmulation, TestSimpleDarwinFunction) {
   ArchSpec arch("arm64-apple-ios10");
-  UnwindAssemblyInstEmulation *engine =
+  std::unique_ptr<UnwindAssemblyInstEmulation> engine(
       static_cast<UnwindAssemblyInstEmulation *>(
-          UnwindAssemblyInstEmulation::CreateInstance(arch));
+          UnwindAssemblyInstEmulation::CreateInstance(arch)));
   ASSERT_NE(nullptr, engine);
 
   UnwindPlan::RowSP row_sp;
@@ -152,9 +152,9 @@ TEST_F(TestArm64InstEmulation, TestSimpl
 
 TEST_F(TestArm64InstEmulation, TestMediumDarwinFunction) {
   ArchSpec arch("arm64-apple-ios10");
-  UnwindAssemblyInstEmulation *engine =
+  std::unique_ptr<UnwindAssemblyInstEmulation> engine(
       static_cast<UnwindAssemblyInstEmulation *>(
-          UnwindAssemblyInstEmulation::CreateInstance(arch));
+          UnwindAssemblyInstEmulation::CreateInstance(arch)));
   ASSERT_NE(nullptr, engine);
 
   UnwindPlan::RowSP row_sp;
@@ -314,9 +314,9 @@ TEST_F(TestArm64InstEmulation, TestMediu
 
 TEST_F(TestArm64InstEmulation, TestFramelessThreeEpilogueFunction) {
   ArchSpec arch("arm64-apple-ios10");
-  UnwindAssemblyInstEmulation *engine =
+  std::unique_ptr<UnwindAssemblyInstEmulation> engine(
       static_cast<UnwindAssemblyInstEmulation *>(
-          UnwindAssemblyInstEmulation::CreateInstance(arch));
+          UnwindAssemblyInstEmulation::CreateInstance(arch)));
   ASSERT_NE(nullptr, engine);
 
   UnwindPlan::RowSP row_sp;
@@ -409,9 +409,9 @@ TEST_F(TestArm64InstEmulation, TestFrame
 
 TEST_F(TestArm64InstEmulation, TestRegisterSavedTwice) {
   ArchSpec arch("arm64-apple-ios10");
-  UnwindAssemblyInstEmulation *engine =
+  std::unique_ptr<UnwindAssemblyInstEmulation> engine(
       static_cast<UnwindAssemblyInstEmulation *>(
-          UnwindAssemblyInstEmulation::CreateInstance(arch));
+          UnwindAssemblyInstEmulation::CreateInstance(arch)));
   ASSERT_NE(nullptr, engine);
 
   UnwindPlan::RowSP row_sp;
@@ -511,9 +511,9 @@ TEST_F(TestArm64InstEmulation, TestRegis
 
 TEST_F(TestArm64InstEmulation, TestRegisterDoubleSpills) {
   ArchSpec arch("arm64-apple-ios10");
-  UnwindAssemblyInstEmulation *engine =
+  std::unique_ptr<UnwindAssemblyInstEmulation> engine(
       static_cast<UnwindAssemblyInstEmulation *>(
-          UnwindAssemblyInstEmulation::CreateInstance(arch));
+          UnwindAssemblyInstEmulation::CreateInstance(arch)));
   ASSERT_NE(nullptr, engine);
 
   UnwindPlan::RowSP row_sp;




More information about the lldb-commits mailing list