diff options
author | fdoray@chromium.org <fdoray@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-15 17:58:15 +0000 |
---|---|---|
committer | fdoray@chromium.org <fdoray@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-15 17:58:15 +0000 |
commit | c94d427b4a54029dd80abb71158a4a3591eb39bb (patch) | |
tree | d6801a76a48eb7df2c844cf7df3772d5a103a34c /base/debug | |
parent | e95e40f8561c5231f475cba340e4c30424d8e0bf (diff) | |
download | chromium_src-c94d427b4a54029dd80abb71158a4a3591eb39bb.zip chromium_src-c94d427b4a54029dd80abb71158a4a3591eb39bb.tar.gz chromium_src-c94d427b4a54029dd80abb71158a4a3591eb39bb.tar.bz2 |
Fix pointer to local variable used after the variable is out of scope in ETW tracing.
In TraceEventETWProvider::TraceEvent, a pointer to |depth| was used after the variable had gone out of scope.
Variable |depth| was declared at line 85. Pointer added to EtwMofEvent at line 89. Pointer used when the event is logged at line 94.
This CL moves the declaration of the variable to the parent scope.
BUG=306831
TEST=No user visible change.
R=dsinclair@chromium.org
Review URL: https://codereview.chromium.org/27115002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228720 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/debug')
-rw-r--r-- | base/debug/trace_event_win.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/base/debug/trace_event_win.cc b/base/debug/trace_event_win.cc index d5a21f4..686ade3 100644 --- a/base/debug/trace_event_win.cc +++ b/base/debug/trace_event_win.cc @@ -78,14 +78,17 @@ void TraceEventETWProvider::TraceEvent(const char* name, event.SetField(1, sizeof(id), &id); event.SetField(2, extra_len + 1, extra); - // See whether we're to capture a backtrace. + // These variables are declared here so that they are not out of scope when + // the event is logged. + DWORD depth; void* backtrace[32]; + + // See whether we're to capture a backtrace. if (enable_flags() & CAPTURE_STACK_TRACE) { - DWORD hash = 0; - DWORD depth = CaptureStackBackTrace(0, - arraysize(backtrace), - backtrace, - &hash); + depth = CaptureStackBackTrace(0, + arraysize(backtrace), + backtrace, + NULL); event.SetField(3, sizeof(depth), &depth); event.SetField(4, sizeof(backtrace[0]) * depth, backtrace); } |