advapi32 tests: fix memory leak (found by Smatch).
Lionel Debroux
lionel_debroux at yahoo.fr
Tue Oct 2 01:59:02 CDT 2007
---
dlls/advapi32/tests/security.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index 6426f84..4abc640 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -1540,6 +1540,7 @@ static void test_process_security(void)
if (!res && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
skip("ACLs not implemented - skipping tests\n");
+ HeapFree(GetProcessHeap(), 0, Acl);
return;
}
ok(res, "InitializeAcl failed with error %d\n", GetLastError());
@@ -1547,7 +1548,11 @@ static void test_process_security(void)
/* get owner from the token we might be running as a user not admin */
res = OpenProcessToken( GetCurrentProcess(), MAXIMUM_ALLOWED, &token );
ok(res, "OpenProcessToken failed with error %d\n", GetLastError());
- if (!res) return;
+ if (!res)
+ {
+ HeapFree(GetProcessHeap(), 0, Acl);
+ return;
+ }
res = GetTokenInformation( token, TokenOwner, owner, sizeof(owner), &tmp );
ok(res, "GetTokenInformation failed with error %d\n", GetLastError());
@@ -1557,7 +1562,11 @@ static void test_process_security(void)
UsersSid = ((TOKEN_PRIMARY_GROUP*)group)->PrimaryGroup;
CloseHandle( token );
- if (!res) return;
+ if (!res)
+ {
+ HeapFree(GetProcessHeap(), 0, Acl);
+ return;
+ }
res = AddAccessDeniedAce(Acl, ACL_REVISION, PROCESS_VM_READ, AdminSid);
ok(res, "AddAccessDeniedAce failed with error %d\n", GetLastError());
--
1.5.3.1
--------------090909010903060005010603--
More information about the wine-patches
mailing list