[ros-diffs] [hbirr] 15700: - Added a missing dereferencing in NtTerminateProcess.

hbirr at svn.reactos.com hbirr at svn.reactos.com
Tue May 31 17:01:32 CEST 2005


- 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;
     }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050531/2686931d/attachment.html


More information about the Ros-diffs mailing list