diff --git a/reactos/dll/win32/kernel32/client/debugger.c b/reactos/dll/win32/kernel32/client/debugger.c index e4e695ef46f..c3244f42a55 100644 --- a/reactos/dll/win32/kernel32/client/debugger.c +++ b/reactos/dll/win32/kernel32/client/debugger.c @@ -305,7 +305,8 @@ RemoveHandles(IN DWORD dwProcessId, /* Loop all thread data events */ ThreadData = (PDBGSS_THREAD_DATA*)NtCurrentTeb()->DbgSsReserved; - for (ThisData = *ThreadData; ThisData; ThisData = ThisData->Next) + ThisData = *ThreadData; + while(ThisData) { /* Check if this one matches */ if ((ThisData->HandleMarked) && @@ -326,6 +327,7 @@ RemoveHandles(IN DWORD dwProcessId, /* Move to the next one */ ThreadData = &ThisData->Next; } + ThisData = *ThreadData; } } @@ -338,7 +340,8 @@ CloseAllProcessHandles(IN DWORD dwProcessId) /* Loop all thread data events */ ThreadData = (PDBGSS_THREAD_DATA*)NtCurrentTeb()->DbgSsReserved; - for (ThisData = *ThreadData; ThisData; ThisData = ThisData->Next) + ThisData = *ThreadData; + while(ThisData) { /* Check if this one matches */ if (ThisData->ProcessId == dwProcessId) @@ -358,6 +361,7 @@ CloseAllProcessHandles(IN DWORD dwProcessId) /* Move to the next one */ ThreadData = &ThisData->Next; } + ThisData = *ThreadData; } }