From 2f6a9da97dc4628fe88bcacfba3d0b43b5b51902 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Wed, 11 Aug 2004 08:32:48 +0000 Subject: [PATCH] little fix svn path=/trunk/; revision=10495 --- reactos/lib/rosrtl/thread/priv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/reactos/lib/rosrtl/thread/priv.c b/reactos/lib/rosrtl/thread/priv.c index e7306cac02d..0f4db72af7e 100644 --- a/reactos/lib/rosrtl/thread/priv.c +++ b/reactos/lib/rosrtl/thread/priv.c @@ -73,13 +73,18 @@ RosEnableThreadPrivileges(HANDLE *hPreviousToken, LocalFree((HLOCAL)privs); /* Perform the impersonation */ - Ret = SetThreadToken(NULL, hToken); + Ret = SetThreadToken(NULL, hNewToken); if(Ret) { /* only copy the previous token handle on success */ *hPreviousToken = hToken; } + else + { + /* We don't return the previous token handle on failure, so close it here */ + CloseHandle(hToken); + } /* We don't need the handle to the new token anymore */ CloseHandle(hNewToken);