mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 09:25:44 +00:00
[ntoskrnl/ps]
- PspCreateThread: If thread creation fails, dereference the Process object also to account for the reference taken at the beginning of the function. svn path=/trunk/; revision=48857
This commit is contained in:
parent
03a0d1dc88
commit
b83eb0a472
1 changed files with 15 additions and 0 deletions
|
@ -280,6 +280,8 @@ PspCreateThread(OUT PHANDLE ThreadHandle,
|
|||
{
|
||||
/* 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 @@ PspCreateThread(OUT PHANDLE ThreadHandle,
|
|||
{
|
||||
/* Fail */
|
||||
ObDereferenceObject(Thread);
|
||||
ObDereferenceObject(Process);
|
||||
ASSERT(FALSE);
|
||||
return STATUS_PROCESS_IS_TERMINATING;
|
||||
}
|
||||
|
||||
|
@ -314,6 +318,8 @@ PspCreateThread(OUT PHANDLE ThreadHandle,
|
|||
/* Failed to create the TEB. Release rundown and dereference */
|
||||
ExReleaseRundownProtection(&Process->RundownProtect);
|
||||
ObDereferenceObject(Thread);
|
||||
ObDereferenceObject(Process);
|
||||
ASSERT(FALSE);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -357,6 +363,9 @@ PspCreateThread(OUT PHANDLE ThreadHandle,
|
|||
/* Release rundown and dereference */
|
||||
ExReleaseRundownProtection(&Process->RundownProtect);
|
||||
ObDereferenceObject(Thread);
|
||||
ObDereferenceObject(Process);
|
||||
ASSERT(FALSE);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -431,6 +440,9 @@ PspCreateThread(OUT PHANDLE ThreadHandle,
|
|||
|
||||
/* Dereference completely to kill it */
|
||||
ObDereferenceObjectEx(Thread, 2);
|
||||
ObDereferenceObject(Process);
|
||||
ASSERT(FALSE);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -513,6 +525,9 @@ PspCreateThread(OUT PHANDLE ThreadHandle,
|
|||
|
||||
/* Close its handle, killing it */
|
||||
ObCloseHandle(ThreadHandle, PreviousMode);
|
||||
ObDereferenceObject(Process);
|
||||
ASSERT(FALSE);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue