Chromium Code Reviews| Index: base/trace_event/heap_profiler_allocation_context_tracker.cc |
| diff --git a/base/trace_event/heap_profiler_allocation_context_tracker.cc b/base/trace_event/heap_profiler_allocation_context_tracker.cc |
| index e192bc833fd950507a5756387b84b5fc92e827ed..46d30acffa3a9f2a85a678ccf0af3ef899465844 100644 |
| --- a/base/trace_event/heap_profiler_allocation_context_tracker.cc |
| +++ b/base/trace_event/heap_profiler_allocation_context_tracker.cc |
| @@ -113,6 +113,12 @@ void AllocationContextTracker::PushCurrentTaskContext(const char* context) { |
| } |
| void AllocationContextTracker::PopCurrentTaskContext(const char* context) { |
| + // Guard for stack underflow. If tracing was started with a TRACE_EVENT in |
| + // scope, the context was never pushed, so it is possible that pop is called |
| + // on an empty stack. |
| + if (task_contexts_.empty()) |
| + return; |
| + |
| DCHECK_EQ(context, task_contexts_.back()) |
|
Primiano Tucci (use gerrit)
2016/04/29 12:02:36
ok following this logic (that is correcT) we shoul
ssid
2016/04/29 12:10:44
This check is still valid because the contexts can
|
| << "Encountered an unmatched context end"; |
| task_contexts_.pop_back(); |