kernel32/tests: Fix memory leaks (found by Smatch).

This commit is contained in:
Lionel Debroux 2007-10-20 21:22:26 +02:00 committed by Alexandre Julliard
parent 5c1334e775
commit 938f748b20
2 changed files with 8 additions and 1 deletions

View File

@ -517,6 +517,7 @@ static void test_info_in_assembly(HANDLE handle, DWORD id, const info_in_assembl
else
ok(info->lpAssemblyDirectoryName == NULL, "info->lpAssemblyDirectoryName = %s\n",
strw(info->lpAssemblyDirectoryName));
HeapFree(GetProcessHeap(), 0, info);
}
static void test_file_info(HANDLE handle, ULONG assid, ULONG fileid, LPCWSTR filename)
@ -560,6 +561,7 @@ static void test_file_info(HANDLE handle, ULONG assid, ULONG fileid, LPCWSTR fil
if(info->lpFileName)
ok(!lstrcmpiW(info->lpFileName, filename), "unexpected info->lpFileName\n");
ok(info->lpFilePath == NULL, "info->lpFilePath != NULL\n");
HeapFree(GetProcessHeap(), 0, info);
}
static HANDLE test_create(const char *file, const char *manifest)

View File

@ -805,6 +805,7 @@ static void test_CreatePipe(void)
/* But now we need to get informed that the pipe is closed */
ok(ReadFile(piperead,readbuf,sizeof(readbuf),&read, NULL) == 0, "Broken pipe not detected\n");
ok(CloseHandle(piperead), "CloseHandle for the read pipe failed\n");
HeapFree(GetProcessHeap(), 0, buffer);
}
struct named_pipe_client_params
@ -1022,7 +1023,11 @@ static BOOL are_all_privileges_disabled(HANDLE hToken)
{
Privileges = HeapAlloc(GetProcessHeap(), 0, Size);
ret = GetTokenInformation(hToken, TokenPrivileges, Privileges, Size, &Size);
if (!ret) return FALSE;
if (!ret)
{
HeapFree(GetProcessHeap(), 0, Privileges);
return FALSE;
}
}
else
return FALSE;