diff --git a/reactos/base/system/smss/smapiexec.c b/reactos/base/system/smss/smapiexec.c index 87d7089f7d8..77f08871d2f 100644 --- a/reactos/base/system/smss/smapiexec.c +++ b/reactos/base/system/smss/smapiexec.c @@ -265,6 +265,8 @@ SMAPI(SmExecPgm) DPRINT1("SM: %s: SmCreateClient failed (Status=0x%08lx)\n", __FUNCTION__, Status); } + NtClose(ProcessInfo.ThreadHandle); + NtClose(ProcessInfo.ProcessHandle); } } else diff --git a/reactos/lib/rtl/thread.c b/reactos/lib/rtl/thread.c index e862e85323e..aafe0b4fb0f 100644 --- a/reactos/lib/rtl/thread.c +++ b/reactos/lib/rtl/thread.c @@ -209,7 +209,10 @@ RtlCreateUserThread(IN HANDLE ProcessHandle, else { /* Return thread data */ - if (ThreadHandle) *ThreadHandle = Handle; + if (ThreadHandle) + *ThreadHandle = Handle; + else + NtClose(Handle); if (ClientId) *ClientId = ThreadCid; }