- Added a missing dereferencing in NtTerminateProcess. - Don't access already freed memory while sending messages to the termination port (in PspExitThread). Modified: trunk/reactos/ntoskrnl/ps/kill.c _____
Modified: trunk/reactos/ntoskrnl/ps/kill.c --- trunk/reactos/ntoskrnl/ps/kill.c 2005-05-31 14:56:55 UTC (rev 15699) +++ trunk/reactos/ntoskrnl/ps/kill.c 2005-05-31 15:01:29 UTC (rev 15700) @@ -266,19 +266,18 @@
}
/* Process the Termination Ports */ - TerminationPort = CurrentThread->TerminationPort; - DPRINT("TerminationPort: %p\n", TerminationPort); - while (TerminationPort) { + while ((TerminationPort = CurrentThread->TerminationPort)) {
+ DPRINT("TerminationPort: %p\n", TerminationPort); + + /* Get the next one */ + CurrentThread->TerminationPort = TerminationPort->Next; + /* Send the LPC Message */ LpcSendTerminationPort(TerminationPort->Port, CurrentThread->CreateTime);
/* Free the Port */ ExFreePool(TerminationPort); - - /* Get the next one */ - TerminationPort = TerminationPort->Next; - DPRINT("TerminationPort: %p\n", TerminationPort); }
/* Rundown Win32 Structures */ @@ -463,6 +462,7 @@ if(Process->ExitTime.QuadPart != 0) { PsUnlockProcess(Process); + ObDereferenceObject(Process); return STATUS_PROCESS_IS_TERMINATING; }