msi/tests: Fix a couple of memory leaks (valgrind).

This commit is contained in:
Hans Leidekker 2014-04-30 10:21:42 +02:00 committed by Alexandre Julliard
parent 582c5fde99
commit 4c8edb1b4c
5 changed files with 25 additions and 15 deletions

View File

@ -2255,20 +2255,22 @@ static void init_functionpointers(void)
static BOOL is_process_limited(void)
{
SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
PSID Group;
PSID Group = NULL;
BOOL IsInGroup;
HANDLE token;
if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0, &Group) ||
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
!pCheckTokenMembership(NULL, Group, &IsInGroup))
{
trace("Could not check if the current user is an administrator\n");
FreeSid(Group);
return FALSE;
}
FreeSid(Group);
if (!IsInGroup)
{
/* Only administrators have enough privileges for these tests */

View File

@ -230,20 +230,22 @@ static void init_functionpointers(void)
static BOOL is_process_limited(void)
{
SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
PSID Group;
PSID Group = NULL;
BOOL IsInGroup;
HANDLE token;
if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0, &Group) ||
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
!pCheckTokenMembership(NULL, Group, &IsInGroup))
{
trace("Could not check if the current user is an administrator\n");
FreeSid(Group);
return FALSE;
}
FreeSid(Group);
if (!IsInGroup)
{
/* Only administrators have enough privileges for these tests */

View File

@ -2043,20 +2043,22 @@ static void init_functionpointers(void)
static BOOL is_process_limited(void)
{
SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
PSID Group;
PSID Group = NULL;
BOOL IsInGroup;
HANDLE token;
if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0, &Group) ||
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
!pCheckTokenMembership(NULL, Group, &IsInGroup))
{
trace("Could not check if the current user is an administrator\n");
FreeSid(Group);
return FALSE;
}
FreeSid(Group);
if (!IsInGroup)
{
/* Only administrators have enough privileges for these tests */

View File

@ -175,20 +175,22 @@ static BOOL delete_pf(const char *rel_path, BOOL is_file)
static BOOL is_process_limited(void)
{
SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
PSID Group;
PSID Group = NULL;
BOOL IsInGroup;
HANDLE token;
if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0, &Group) ||
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
!pCheckTokenMembership(NULL, Group, &IsInGroup))
{
trace("Could not check if the current user is an administrator\n");
FreeSid(Group);
return FALSE;
}
FreeSid(Group);
if (!IsInGroup)
{
/* Only administrators have enough privileges for these tests */

View File

@ -88,20 +88,22 @@ static void init_functionpointers(void)
static BOOL is_process_limited(void)
{
SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
PSID Group;
PSID Group = NULL;
BOOL IsInGroup;
HANDLE token;
if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0, &Group) ||
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
!pCheckTokenMembership(NULL, Group, &IsInGroup))
{
trace("Could not check if the current user is an administrator\n");
FreeSid(Group);
return FALSE;
}
FreeSid(Group);
if (!IsInGroup)
{
if (!AllocateAndInitializeSid(&NtAuthority, 2,