diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c index 12d2c9abe2f..bf06d9dc8bd 100644 --- a/dlls/msi/registry.c +++ b/dlls/msi/registry.c @@ -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; }