mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 06:15:26 +00:00
Stack is freed on failure.
svn path=/trunk/; revision=662
This commit is contained in:
parent
40f81ce970
commit
3255097117
1 changed files with 25 additions and 2 deletions
|
@ -42,6 +42,7 @@ RtlCreateUserThread(HANDLE ProcessHandle,
|
|||
ULONG ReservedSize;
|
||||
ULONG CommitSize;
|
||||
ULONG GuardSize;
|
||||
ULONG RegionSize;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* initialize initial teb */
|
||||
|
@ -57,6 +58,8 @@ RtlCreateUserThread(HANDLE ProcessHandle,
|
|||
|
||||
GuardSize = PAGESIZE;
|
||||
|
||||
RegionSize = 0;
|
||||
|
||||
/* Reserve stack */
|
||||
InitialTeb.StackReserved = NULL;
|
||||
Status = NtAllocateVirtualMemory(ProcessHandle,
|
||||
|
@ -93,6 +96,12 @@ RtlCreateUserThread(HANDLE ProcessHandle,
|
|||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* release the stack space */
|
||||
NtFreeVirtualMemory(ProcessHandle,
|
||||
InitialTeb.StackReserved,
|
||||
&RegionSize,
|
||||
MEM_RELEASE);
|
||||
|
||||
DPRINT("Error committing stack page!\n");
|
||||
return Status;
|
||||
}
|
||||
|
@ -110,6 +119,12 @@ RtlCreateUserThread(HANDLE ProcessHandle,
|
|||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* release the stack space */
|
||||
NtFreeVirtualMemory(ProcessHandle,
|
||||
InitialTeb.StackReserved,
|
||||
&RegionSize,
|
||||
MEM_RELEASE);
|
||||
|
||||
DPRINT("Error committing guard page!\n");
|
||||
return Status;
|
||||
}
|
||||
|
@ -144,14 +159,13 @@ RtlCreateUserThread(HANDLE ProcessHandle,
|
|||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ULONG RegionSize = 0;
|
||||
|
||||
/* release the stack space */
|
||||
NtFreeVirtualMemory(ProcessHandle,
|
||||
InitialTeb.StackReserved,
|
||||
&RegionSize,
|
||||
MEM_RELEASE);
|
||||
|
||||
DPRINT("Error creating thread!\n");
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -223,4 +237,13 @@ RtlInitializeContext(HANDLE ProcessHandle,
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS STDCALL
|
||||
RtlDestroyUserThreadStack(param1, param2)
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue