From 0c9195c650d745f14304557645e44d8a9823db71 Mon Sep 17 00:00:00 2001 From: Robert Shearman Date: Thu, 14 Jul 2005 10:14:44 +0000 Subject: [PATCH] Remove additional current process tracking in backtrace_all as it can refer to freed memory. --- programs/winedbg/stack.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/programs/winedbg/stack.c b/programs/winedbg/stack.c index e175997969b..b080f0ba0d3 100644 --- a/programs/winedbg/stack.c +++ b/programs/winedbg/stack.c @@ -209,17 +209,13 @@ static void backtrace_all(void) entry.dwSize = sizeof(entry); if (Thread32First(snapshot, &entry)) { - struct dbg_process* cp = dbg_curr_process; - DWORD cpid = dbg_curr_pid; do { if (entry.th32OwnerProcessID == GetCurrentProcessId()) continue; - if (dbg_curr_process && dbg_curr_pid != cpid) + if (dbg_curr_process && dbg_curr_pid != entry.th32OwnerProcessID) dbg_detach_debuggee(); - if (entry.th32OwnerProcessID == cpid) - dbg_curr_process = cp; - else if (entry.th32OwnerProcessID != dbg_curr_pid) + if (entry.th32OwnerProcessID != dbg_curr_pid) { if (!dbg_attach_debuggee(entry.th32OwnerProcessID, FALSE, TRUE)) { @@ -236,9 +232,8 @@ static void backtrace_all(void) } while (Thread32Next(snapshot, &entry)); - if (dbg_curr_process && dbg_curr_pid != cpid) + if (dbg_curr_process) dbg_detach_debuggee(); - dbg_curr_process = cp; dbg_curr_pid = cpid; } CloseHandle(snapshot); }