From a15a38c104f805851a69b7a932ea597bee86202e Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 12 Dec 2011 01:55:28 +0100 Subject: [PATCH] Fix use after free. CID 10567. --- src/bin/gdb/gdb/haiku-nat.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bin/gdb/gdb/haiku-nat.c b/src/bin/gdb/gdb/haiku-nat.c index 94cbecdf89..e793624d21 100644 --- a/src/bin/gdb/gdb/haiku-nat.c +++ b/src/bin/gdb/gdb/haiku-nat.c @@ -1291,11 +1291,12 @@ TRACE(("haiku_child_wait_internal(): B_DEBUGGER_MESSAGE_HANDED_OVER: causing " thread->reprocess_event = (reprocessEvent >= 0 ? reprocessEvent : 0); } else { + thread_id originThread = event->data.origin.thread; xfree(event); // continue the thread - if (event->data.origin.thread >= 0) { - haiku_continue_thread(teamDebugInfo, event->data.origin.thread, + if (originThread >= 0) { + haiku_continue_thread(teamDebugInfo, originThread, B_THREAD_DEBUG_HANDLE_EVENT, false); }