From 717a13e2d77103407b119f435484d2199ab35b83 Mon Sep 17 00:00:00 2001 From: Jeffrey Morlan Date: Thu, 31 Jul 2008 21:33:17 +0000 Subject: [PATCH] Fix handle leaks in RtlCreateUserThread and SmExecPgm. svn path=/trunk/; revision=34984 --- reactos/base/system/smss/smapiexec.c | 2 ++ reactos/lib/rtl/thread.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) 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; }