Commit 4c8edb1b authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

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

parent 582c5fde
...@@ -2255,20 +2255,22 @@ static void init_functionpointers(void) ...@@ -2255,20 +2255,22 @@ static void init_functionpointers(void)
static BOOL is_process_limited(void) static BOOL is_process_limited(void)
{ {
SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
PSID Group; PSID Group = NULL;
BOOL IsInGroup; BOOL IsInGroup;
HANDLE token; HANDLE token;
if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE; if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
0, 0, 0, 0, 0, 0, &Group) ||
!pCheckTokenMembership(NULL, Group, &IsInGroup)) !pCheckTokenMembership(NULL, Group, &IsInGroup))
{ {
trace("Could not check if the current user is an administrator\n"); trace("Could not check if the current user is an administrator\n");
FreeSid(Group);
return FALSE; return FALSE;
} }
FreeSid(Group);
if (!IsInGroup) if (!IsInGroup)
{ {
/* Only administrators have enough privileges for these tests */ /* Only administrators have enough privileges for these tests */
......
...@@ -230,20 +230,22 @@ static void init_functionpointers(void) ...@@ -230,20 +230,22 @@ static void init_functionpointers(void)
static BOOL is_process_limited(void) static BOOL is_process_limited(void)
{ {
SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
PSID Group; PSID Group = NULL;
BOOL IsInGroup; BOOL IsInGroup;
HANDLE token; HANDLE token;
if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE; if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
0, 0, 0, 0, 0, 0, &Group) ||
!pCheckTokenMembership(NULL, Group, &IsInGroup)) !pCheckTokenMembership(NULL, Group, &IsInGroup))
{ {
trace("Could not check if the current user is an administrator\n"); trace("Could not check if the current user is an administrator\n");
FreeSid(Group);
return FALSE; return FALSE;
} }
FreeSid(Group);
if (!IsInGroup) if (!IsInGroup)
{ {
/* Only administrators have enough privileges for these tests */ /* Only administrators have enough privileges for these tests */
......
...@@ -2043,20 +2043,22 @@ static void init_functionpointers(void) ...@@ -2043,20 +2043,22 @@ static void init_functionpointers(void)
static BOOL is_process_limited(void) static BOOL is_process_limited(void)
{ {
SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
PSID Group; PSID Group = NULL;
BOOL IsInGroup; BOOL IsInGroup;
HANDLE token; HANDLE token;
if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE; if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
0, 0, 0, 0, 0, 0, &Group) ||
!pCheckTokenMembership(NULL, Group, &IsInGroup)) !pCheckTokenMembership(NULL, Group, &IsInGroup))
{ {
trace("Could not check if the current user is an administrator\n"); trace("Could not check if the current user is an administrator\n");
FreeSid(Group);
return FALSE; return FALSE;
} }
FreeSid(Group);
if (!IsInGroup) if (!IsInGroup)
{ {
/* Only administrators have enough privileges for these tests */ /* Only administrators have enough privileges for these tests */
......
...@@ -175,20 +175,22 @@ static BOOL delete_pf(const char *rel_path, BOOL is_file) ...@@ -175,20 +175,22 @@ static BOOL delete_pf(const char *rel_path, BOOL is_file)
static BOOL is_process_limited(void) static BOOL is_process_limited(void)
{ {
SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
PSID Group; PSID Group = NULL;
BOOL IsInGroup; BOOL IsInGroup;
HANDLE token; HANDLE token;
if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE; if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
0, 0, 0, 0, 0, 0, &Group) ||
!pCheckTokenMembership(NULL, Group, &IsInGroup)) !pCheckTokenMembership(NULL, Group, &IsInGroup))
{ {
trace("Could not check if the current user is an administrator\n"); trace("Could not check if the current user is an administrator\n");
FreeSid(Group);
return FALSE; return FALSE;
} }
FreeSid(Group);
if (!IsInGroup) if (!IsInGroup)
{ {
/* Only administrators have enough privileges for these tests */ /* Only administrators have enough privileges for these tests */
......
...@@ -88,20 +88,22 @@ static void init_functionpointers(void) ...@@ -88,20 +88,22 @@ static void init_functionpointers(void)
static BOOL is_process_limited(void) static BOOL is_process_limited(void)
{ {
SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
PSID Group; PSID Group = NULL;
BOOL IsInGroup; BOOL IsInGroup;
HANDLE token; HANDLE token;
if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE; if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
0, 0, 0, 0, 0, 0, &Group) ||
!pCheckTokenMembership(NULL, Group, &IsInGroup)) !pCheckTokenMembership(NULL, Group, &IsInGroup))
{ {
trace("Could not check if the current user is an administrator\n"); trace("Could not check if the current user is an administrator\n");
FreeSid(Group);
return FALSE; return FALSE;
} }
FreeSid(Group);
if (!IsInGroup) if (!IsInGroup)
{ {
if (!AllocateAndInitializeSid(&NtAuthority, 2, if (!AllocateAndInitializeSid(&NtAuthority, 2,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment