msi: Fix process token leak.

This commit is contained in:
Christoph von Wittich 2008-01-20 17:58:40 +01:00 committed by Alexandre Julliard
parent 0acfe68864
commit 007833f130
1 changed files with 7 additions and 3 deletions

View File

@ -478,13 +478,17 @@ static UINT get_user_sid(LPWSTR *usersid)
return ERROR_FUNCTION_FAILED;
size = sizeof(buf);
if (!GetTokenInformation(token, TokenUser, (void *)buf, size, &size))
if (!GetTokenInformation(token, TokenUser, (void *)buf, size, &size)) {
CloseHandle(token);
return ERROR_FUNCTION_FAILED;
}
user = (PTOKEN_USER)buf;
if (!ConvertSidToStringSidW(user->User.Sid, usersid))
if (!ConvertSidToStringSidW(user->User.Sid, usersid)) {
CloseHandle(token);
return ERROR_FUNCTION_FAILED;
}
CloseHandle(token);
return ERROR_SUCCESS;
}