Commit e543eeb4 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

advapi32/tests: Fix some leaks in tests (Valgrind).

parent e0113072
...@@ -3124,6 +3124,7 @@ static void test_CreateDirectoryA(void) ...@@ -3124,6 +3124,7 @@ static void test_CreateDirectoryA(void)
ok(ace->Mask == 0x1f01ff, "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n", ok(ace->Mask == 0x1f01ff, "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n",
ace->Mask); ace->Mask);
} }
LocalFree(pSD);
done: done:
HeapFree(GetProcessHeap(), 0, user); HeapFree(GetProcessHeap(), 0, user);
...@@ -3231,10 +3232,12 @@ static void test_GetNamedSecurityInfoA(void) ...@@ -3231,10 +3232,12 @@ static void test_GetNamedSecurityInfoA(void)
NULL, NULL, NULL, NULL, NULL); NULL, NULL, NULL, NULL, NULL);
ok(error==ERROR_INVALID_PARAMETER, "GetNamedSecurityInfo failed with error %d\n", error); ok(error==ERROR_INVALID_PARAMETER, "GetNamedSecurityInfo failed with error %d\n", error);
pDacl = NULL;
error = pGetNamedSecurityInfoA(windows_dir, SE_FILE_OBJECT,DACL_SECURITY_INFORMATION, error = pGetNamedSecurityInfoA(windows_dir, SE_FILE_OBJECT,DACL_SECURITY_INFORMATION,
NULL, NULL, &pDacl, NULL, NULL); NULL, NULL, &pDacl, NULL, &pSD);
ok(!error, "GetNamedSecurityInfo failed with error %d\n", error); ok(!error, "GetNamedSecurityInfo failed with error %d\n", error);
ok(pDacl != NULL, "DACL should not be NULL\n"); ok(pDacl != NULL, "DACL should not be NULL\n");
LocalFree(pSD);
error = pGetNamedSecurityInfoA(windows_dir, SE_FILE_OBJECT,OWNER_SECURITY_INFORMATION, error = pGetNamedSecurityInfoA(windows_dir, SE_FILE_OBJECT,OWNER_SECURITY_INFORMATION,
NULL, NULL, &pDacl, NULL, NULL); NULL, NULL, &pDacl, NULL, NULL);
...@@ -3950,7 +3953,7 @@ static void test_GetSecurityInfo(void) ...@@ -3950,7 +3953,7 @@ static void test_GetSecurityInfo(void)
NULL, NULL, pDacl, NULL); NULL, NULL, pDacl, NULL);
ok(ret == ERROR_SUCCESS, "SetSecurityInfo returned %d\n", ret); ok(ret == ERROR_SUCCESS, "SetSecurityInfo returned %d\n", ret);
ret = pGetSecurityInfo(obj, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, ret = pGetSecurityInfo(obj, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION,
NULL, NULL, &pDacl, NULL, NULL); NULL, NULL, &pDacl, NULL, &pSD);
ok(ret == ERROR_SUCCESS, "GetSecurityInfo returned %d\n", ret); ok(ret == ERROR_SUCCESS, "GetSecurityInfo returned %d\n", ret);
ok(pDacl && IsValidAcl(pDacl), "GetSecurityInfo returned invalid DACL.\n"); ok(pDacl && IsValidAcl(pDacl), "GetSecurityInfo returned invalid DACL.\n");
bret = pGetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation); bret = pGetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation);
...@@ -3977,6 +3980,7 @@ static void test_GetSecurityInfo(void) ...@@ -3977,6 +3980,7 @@ static void test_GetSecurityInfo(void)
ok(ace->Mask == 0x1f01ff, "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n", ok(ace->Mask == 0x1f01ff, "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n",
ace->Mask); ace->Mask);
} }
LocalFree(pSD);
CloseHandle(obj); CloseHandle(obj);
} }
......
...@@ -136,6 +136,7 @@ static void test_open_svc(void) ...@@ -136,6 +136,7 @@ static void test_open_svc(void)
ok(GetLastError() == ERROR_INVALID_ADDRESS /* W2K, XP, W2K3, Vista */ || ok(GetLastError() == ERROR_INVALID_ADDRESS /* W2K, XP, W2K3, Vista */ ||
GetLastError() == ERROR_INVALID_PARAMETER /* NT4 */, GetLastError() == ERROR_INVALID_PARAMETER /* NT4 */,
"Expected ERROR_INVALID_ADDRESS or ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); "Expected ERROR_INVALID_ADDRESS or ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
CloseServiceHandle(scm_handle);
/* Nonexistent service */ /* Nonexistent service */
scm_handle = OpenSCManagerA(NULL, NULL, SC_MANAGER_CONNECT); scm_handle = OpenSCManagerA(NULL, NULL, SC_MANAGER_CONNECT);
...@@ -1840,8 +1841,9 @@ static void test_sequence(void) ...@@ -1840,8 +1841,9 @@ static void test_sequence(void)
if (!is_nt4) if (!is_nt4)
{ {
retval = pGetSecurityInfo(svc_handle, SE_SERVICE, DACL_SECURITY_INFORMATION, NULL, retval = pGetSecurityInfo(svc_handle, SE_SERVICE, DACL_SECURITY_INFORMATION, NULL,
NULL, &dacl, NULL, NULL); NULL, &dacl, NULL, &pSD);
ok(retval == ERROR_SUCCESS, "Expected GetSecurityInfo to succeed: result %d\n", retval); ok(retval == ERROR_SUCCESS, "Expected GetSecurityInfo to succeed: result %d\n", retval);
LocalFree(pSD);
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
retval = pGetSecurityInfo(svc_handle, SE_SERVICE, DACL_SECURITY_INFORMATION, NULL, retval = pGetSecurityInfo(svc_handle, SE_SERVICE, DACL_SECURITY_INFORMATION, NULL,
NULL, NULL, NULL, NULL); NULL, NULL, NULL, NULL);
......
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