[ros-diffs] [mjmartin] 48857: [ntoskrnl/ps] - PspCreateThread: If thread creation fails, dereference the Process object also to account for the reference taken at the beginning of the function.

mjmartin at svn.reactos.org mjmartin at svn.reactos.org
Fri Sep 24 10:07:54 UTC 2010


Author: mjmartin
Date: Fri Sep 24 10:07:54 2010
New Revision: 48857

URL: http://svn.reactos.org/svn/reactos?rev=48857&view=rev
Log:
[ntoskrnl/ps]
- PspCreateThread: If thread creation fails, dereference the Process object also to account for the reference taken at the beginning of the function.

Modified:
    trunk/reactos/ntoskrnl/ps/thread.c

Modified: trunk/reactos/ntoskrnl/ps/thread.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/thread.c?rev=48857&r1=48856&r2=48857&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ps/thread.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ps/thread.c [iso-8859-1] Fri Sep 24 10:07:54 2010
@@ -280,6 +280,8 @@
     {
         /* We couldn't create the CID, dereference the thread and fail */
         ObDereferenceObject(Thread);
+        ObDereferenceObject(Process);
+        ASSERT(FALSE);
         return STATUS_INSUFFICIENT_RESOURCES;
     }
 
@@ -301,6 +303,8 @@
     {
         /* Fail */
         ObDereferenceObject(Thread);
+        ObDereferenceObject(Process);
+        ASSERT(FALSE);
         return STATUS_PROCESS_IS_TERMINATING;
     }
 
@@ -314,6 +318,8 @@
             /* Failed to create the TEB. Release rundown and dereference */
             ExReleaseRundownProtection(&Process->RundownProtect);
             ObDereferenceObject(Thread);
+            ObDereferenceObject(Process);
+            ASSERT(FALSE);
             return Status;
         }
 
@@ -357,6 +363,9 @@
         /* Release rundown and dereference */
         ExReleaseRundownProtection(&Process->RundownProtect);
         ObDereferenceObject(Thread);
+        ObDereferenceObject(Process);
+        ASSERT(FALSE);
+
         return Status;
     }
 
@@ -431,6 +440,9 @@
 
         /* Dereference completely to kill it */
         ObDereferenceObjectEx(Thread, 2);
+        ObDereferenceObject(Process);
+        ASSERT(FALSE);
+
         return Status;
     }
 
@@ -513,6 +525,9 @@
 
             /* Close its handle, killing it */
             ObCloseHandle(ThreadHandle, PreviousMode);
+            ObDereferenceObject(Process);
+            ASSERT(FALSE);
+
             return Status;
         }
 




More information about the Ros-diffs mailing list