From 3a9ac188d40abee8689126bc0bf1a5b85054f625 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sat, 15 Aug 2015 22:12:26 -0700 Subject: [PATCH] Debugger: Fix use-after-free in breakpoint clearing code (again) --- CHANGES | 1 + src/debugger/debugger.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGES b/CHANGES index e80077b62..a6d461e3b 100644 --- a/CHANGES +++ b/CHANGES @@ -73,6 +73,7 @@ Bugfixes: - GBA Video: Fix timing on first scanline - GBA: Ensure cycles never go negative - Util: Fix formatting of floats + - Debugger: Fix use-after-free in breakpoint clearing code Misc: - Qt: Handle saving input settings better - Debugger: Free watchpoints in addition to breakpoints diff --git a/src/debugger/debugger.c b/src/debugger/debugger.c index f886db969..62d47680b 100644 --- a/src/debugger/debugger.c +++ b/src/debugger/debugger.c @@ -155,6 +155,7 @@ void ARMDebuggerClearBreakpoint(struct ARMDebugger* debugger, uint32_t address) if (breakpoint->address == address) { *previous = *next; free(breakpoint); + continue; } previous = next; } @@ -179,6 +180,7 @@ void ARMDebuggerClearWatchpoint(struct ARMDebugger* debugger, uint32_t address) if (watchpoint->address == address) { *previous = *next; free(watchpoint); + continue; } previous = next; }