Fix memory leak in ppc stackwalker

BUG=756317

Change-Id: Id096372e5a0d1e7c70e95304b1f0c181f57d3882
Reviewed-on: https://chromium-review.googlesource.com/619126
Reviewed-by: Leonard Mosescu <mosescu@chromium.org>
This commit is contained in:
Tobias Sargeant 2017-08-17 14:57:38 +01:00 committed by Tobias Sargeant
parent 38cbbfed71
commit b1e7ec065d

View File

@ -34,6 +34,7 @@
// Author: Mark Mentovai // Author: Mark Mentovai
#include "common/scoped_ptr.h"
#include "processor/stackwalker_ppc.h" #include "processor/stackwalker_ppc.h"
#include "google_breakpad/processor/call_stack.h" #include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/memory_region.h" #include "google_breakpad/processor/memory_region.h"
@ -121,7 +122,7 @@ StackFrame* StackwalkerPPC::GetCallerFrame(const CallStack* stack,
return NULL; return NULL;
} }
StackFramePPC* frame = new StackFramePPC(); scoped_ptr<StackFramePPC> frame(new StackFramePPC());
frame->context = last_frame->context; frame->context = last_frame->context;
frame->context.srr0 = instruction; frame->context.srr0 = instruction;
@ -147,7 +148,7 @@ StackFrame* StackwalkerPPC::GetCallerFrame(const CallStack* stack,
// return address value may access the context.srr0 field of StackFramePPC. // return address value may access the context.srr0 field of StackFramePPC.
frame->instruction = frame->context.srr0 - 4; frame->instruction = frame->context.srr0 - 4;
return frame; return frame.release();
} }