[KERNEL32]

- do not access memory that might have been freed

svn path=/trunk/; revision=53482
This commit is contained in:
Jérôme Gardou 2011-08-28 17:30:25 +00:00
parent e95dd604c1
commit d7548bc164

View file

@ -305,7 +305,8 @@ RemoveHandles(IN DWORD dwProcessId,
/* Loop all thread data events */ /* Loop all thread data events */
ThreadData = (PDBGSS_THREAD_DATA*)NtCurrentTeb()->DbgSsReserved; ThreadData = (PDBGSS_THREAD_DATA*)NtCurrentTeb()->DbgSsReserved;
for (ThisData = *ThreadData; ThisData; ThisData = ThisData->Next) ThisData = *ThreadData;
while(ThisData)
{ {
/* Check if this one matches */ /* Check if this one matches */
if ((ThisData->HandleMarked) && if ((ThisData->HandleMarked) &&
@ -326,6 +327,7 @@ RemoveHandles(IN DWORD dwProcessId,
/* Move to the next one */ /* Move to the next one */
ThreadData = &ThisData->Next; ThreadData = &ThisData->Next;
} }
ThisData = *ThreadData;
} }
} }
@ -338,7 +340,8 @@ CloseAllProcessHandles(IN DWORD dwProcessId)
/* Loop all thread data events */ /* Loop all thread data events */
ThreadData = (PDBGSS_THREAD_DATA*)NtCurrentTeb()->DbgSsReserved; ThreadData = (PDBGSS_THREAD_DATA*)NtCurrentTeb()->DbgSsReserved;
for (ThisData = *ThreadData; ThisData; ThisData = ThisData->Next) ThisData = *ThreadData;
while(ThisData)
{ {
/* Check if this one matches */ /* Check if this one matches */
if (ThisData->ProcessId == dwProcessId) if (ThisData->ProcessId == dwProcessId)
@ -358,6 +361,7 @@ CloseAllProcessHandles(IN DWORD dwProcessId)
/* Move to the next one */ /* Move to the next one */
ThreadData = &ThisData->Next; ThreadData = &ThisData->Next;
} }
ThisData = *ThreadData;
} }
} }