From 3cef0e5645c06faf83d06c0dd6432174d2bfd0cc Mon Sep 17 00:00:00 2001 From: "thestig@chromium.org" Date: Wed, 28 May 2014 16:51:52 +0000 Subject: [PATCH] Fix a memory leak in DwarfCUToModule::FuncHandler::Finish(). BUG=591 R=mark@chromium.org Review URL: https://breakpad.appspot.com/2704002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1333 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/common/dwarf_cu_to_module.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/dwarf_cu_to_module.cc b/src/common/dwarf_cu_to_module.cc index 8246daf9..1d157def 100644 --- a/src/common/dwarf_cu_to_module.cc +++ b/src/common/dwarf_cu_to_module.cc @@ -531,7 +531,7 @@ void DwarfCUToModule::FuncHandler::Finish() { if (low_pc_ < high_pc_) { // Create a Module::Function based on the data we've gathered, and // add it to the functions_ list. - Module::Function *func = new Module::Function; + scoped_ptr func(new Module::Function); // Malformed DWARF may omit the name, but all Module::Functions must // have names. if (!name_.empty()) { @@ -546,7 +546,7 @@ void DwarfCUToModule::FuncHandler::Finish() { if (func->address) { // If the function address is zero this is a sign that this function // description is just empty debug data and should just be discarded. - cu_context_->functions.push_back(func); + cu_context_->functions.push_back(func.release()); } } else if (inline_) { AbstractOrigin origin(name_);