Nikolay Sivov : advapi32/tests: Fix some leaks in tests (Valgrind).
Alexandre Julliard
julliard at winehq.org
Fri Apr 25 14:15:24 CDT 2014
Module: wine
Branch: master
Commit: e543eeb42be157a5c6fb6bc17825d394af699aa4
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e543eeb42be157a5c6fb6bc17825d394af699aa4
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri Apr 25 09:22:48 2014 +0400
advapi32/tests: Fix some leaks in tests (Valgrind).
---
dlls/advapi32/tests/security.c | 8 ++++++--
dlls/advapi32/tests/service.c | 4 +++-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index bd45189..a0574c4 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -3124,6 +3124,7 @@ static void test_CreateDirectoryA(void)
ok(ace->Mask == 0x1f01ff, "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n",
ace->Mask);
}
+ LocalFree(pSD);
done:
HeapFree(GetProcessHeap(), 0, user);
@@ -3231,10 +3232,12 @@ static void test_GetNamedSecurityInfoA(void)
NULL, NULL, NULL, NULL, NULL);
ok(error==ERROR_INVALID_PARAMETER, "GetNamedSecurityInfo failed with error %d\n", error);
+ pDacl = NULL;
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(pDacl != NULL, "DACL should not be NULL\n");
+ LocalFree(pSD);
error = pGetNamedSecurityInfoA(windows_dir, SE_FILE_OBJECT,OWNER_SECURITY_INFORMATION,
NULL, NULL, &pDacl, NULL, NULL);
@@ -3950,7 +3953,7 @@ static void test_GetSecurityInfo(void)
NULL, NULL, pDacl, NULL);
ok(ret == ERROR_SUCCESS, "SetSecurityInfo returned %d\n", ret);
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(pDacl && IsValidAcl(pDacl), "GetSecurityInfo returned invalid DACL.\n");
bret = pGetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation);
@@ -3977,6 +3980,7 @@ static void test_GetSecurityInfo(void)
ok(ace->Mask == 0x1f01ff, "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n",
ace->Mask);
}
+ LocalFree(pSD);
CloseHandle(obj);
}
diff --git a/dlls/advapi32/tests/service.c b/dlls/advapi32/tests/service.c
index 9b6c1cf..4ebae1c 100644
--- a/dlls/advapi32/tests/service.c
+++ b/dlls/advapi32/tests/service.c
@@ -136,6 +136,7 @@ static void test_open_svc(void)
ok(GetLastError() == ERROR_INVALID_ADDRESS /* W2K, XP, W2K3, Vista */ ||
GetLastError() == ERROR_INVALID_PARAMETER /* NT4 */,
"Expected ERROR_INVALID_ADDRESS or ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+ CloseServiceHandle(scm_handle);
/* Nonexistent service */
scm_handle = OpenSCManagerA(NULL, NULL, SC_MANAGER_CONNECT);
@@ -1840,8 +1841,9 @@ static void test_sequence(void)
if (!is_nt4)
{
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);
+ LocalFree(pSD);
SetLastError(0xdeadbeef);
retval = pGetSecurityInfo(svc_handle, SE_SERVICE, DACL_SECURITY_INFORMATION, NULL,
NULL, NULL, NULL, NULL);
More information about the wine-cvs
mailing list