[Lldb-commits] [lldb] r323085 - Fix memory leaks in MinidumpParserTest
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Mon Jan 22 01:48:41 PST 2018
Author: teemperor
Date: Mon Jan 22 01:48:40 2018
New Revision: 323085
URL: http://llvm.org/viewvc/llvm-project?rev=323085&view=rev
Log:
Fix memory leaks in MinidumpParserTest
Summary: We never delete the allocated RegisterContext objects, causing those tests to fail with enabled memory sanitizer.
Reviewers: dvlahovski, zturner
Reviewed By: zturner
Subscribers: zturner, lldb-commits
Differential Revision: https://reviews.llvm.org/D42347
Modified:
lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp
Modified: lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp?rev=323085&r1=323084&r2=323085&view=diff
==============================================================================
--- lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp (original)
+++ lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp Mon Jan 22 01:48:40 2018
@@ -315,9 +315,9 @@ TEST_F(MinidumpParserTest, ConvertMinidu
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 @@ TEST_F(MinidumpParserTest, ConvertMinidu
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 @@ TEST_F(MinidumpParserTest, ConvertMinidu
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();
More information about the lldb-commits
mailing list