[Lldb-commits] [PATCH] D42347: Fix memory leaks in MinidumpParserTest

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 22 01:48:25 PST 2018


teemperor updated this revision to Diff 130846.
teemperor added a comment.

- Using make_unique now.


https://reviews.llvm.org/D42347

Files:
  unittests/Process/minidump/MinidumpParserTest.cpp


Index: unittests/Process/minidump/MinidumpParserTest.cpp
===================================================================
--- unittests/Process/minidump/MinidumpParserTest.cpp
+++ unittests/Process/minidump/MinidumpParserTest.cpp
@@ -315,9 +315,9 @@
   llvm::ArrayRef<uint8_t> registers(parser->GetThreadContext(thread));
 
   ArchSpec arch = parser->GetArchitecture();
-  RegisterInfoInterface *reg_interface = new RegisterContextLinux_i386(arch);
+  auto reg_interface = llvm::make_unique<RegisterContextLinux_i386>(arch);
   lldb::DataBufferSP buf =
-      ConvertMinidumpContext_x86_32(registers, reg_interface);
+      ConvertMinidumpContext_x86_32(registers, reg_interface.get());
   ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize());
 
   const RegisterInfo *reg_info = reg_interface->GetRegisterInfo();
@@ -357,9 +357,9 @@
   llvm::ArrayRef<uint8_t> registers(parser->GetThreadContext(thread));
 
   ArchSpec arch = parser->GetArchitecture();
-  RegisterInfoInterface *reg_interface = new RegisterContextLinux_x86_64(arch);
+  auto reg_interface = llvm::make_unique<RegisterContextLinux_x86_64>(arch);
   lldb::DataBufferSP buf =
-      ConvertMinidumpContext_x86_64(registers, reg_interface);
+      ConvertMinidumpContext_x86_64(registers, reg_interface.get());
   ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize());
 
   const RegisterInfo *reg_info = reg_interface->GetRegisterInfo();
@@ -407,9 +407,9 @@
   llvm::ArrayRef<uint8_t> registers(parser->GetThreadContextWow64(thread));
 
   ArchSpec arch = parser->GetArchitecture();
-  RegisterInfoInterface *reg_interface = new RegisterContextLinux_i386(arch);
+  auto reg_interface = llvm::make_unique<RegisterContextLinux_i386>(arch);
   lldb::DataBufferSP buf =
-      ConvertMinidumpContext_x86_32(registers, reg_interface);
+      ConvertMinidumpContext_x86_32(registers, reg_interface.get());
   ASSERT_EQ(reg_interface->GetGPRSize(), buf->GetByteSize());
 
   const RegisterInfo *reg_info = reg_interface->GetRegisterInfo();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42347.130846.patch
Type: text/x-patch
Size: 2012 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180122/951b25c9/attachment.bin>


More information about the lldb-commits mailing list