Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Unified Diff: runtime/vm/debugger.cc

Issue 1151263004: Fix use-after-free deleting from linked list. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger.cc
diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc
index 91bbb42d01a0ba068ad36c54253dd1555ceaba4f..516caf7b770fe37960b330d97e7a361b34bc063c 100644
--- a/runtime/vm/debugger.cc
+++ b/runtime/vm/debugger.cc
@@ -2809,7 +2809,7 @@ void Debugger::RemoveBreakpoint(intptr_t bp_id) {
if (curr_loc->breakpoints() == NULL) {
if (prev_loc == NULL) {
- breakpoint_locations_ = breakpoint_locations_->next();
+ breakpoint_locations_ = curr_loc->next();
} else {
prev_loc->set_next(curr_loc->next());
}
@@ -2817,11 +2817,13 @@ void Debugger::RemoveBreakpoint(intptr_t bp_id) {
// Remove references from code breakpoints to this source breakpoint,
// and disable the code breakpoints.
UnlinkCodeBreakpoints(curr_loc);
+ BreakpointLocation* next_loc = curr_loc->next();
delete curr_loc;
+ curr_loc = next_loc;
+ } else {
+ prev_loc = curr_loc;
+ curr_loc = curr_loc->next();
}
-
- prev_loc = curr_loc;
- curr_loc = curr_loc->next();
}
// bpt is not a registered breakpoint, nothing to do.
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698