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

llvm-svn: 323085
This commit is contained in:
Raphael Isemann 2018-01-22 09:48:40 +00:00
parent 44197df7a3
commit 8f52340766

View File

@ -315,9 +315,9 @@ TEST_F(MinidumpParserTest, ConvertMinidumpContext_x86_32) {
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, ConvertMinidumpContext_x86_64) {
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, ConvertMinidumpContext_x86_32_wow64) {
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();