reg/tests: Free the WCHAR memory buffer if CreateFile() fails.

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hugh McMaster 2017-08-23 12:31:56 +00:00 committed by Alexandre Julliard
parent c618e99475
commit e0a97d32e2
1 changed files with 4 additions and 1 deletions

View File

@ -771,8 +771,11 @@ static BOOL test_import_wstr_(unsigned line, const char *file_contents, DWORD *r
regfile = CreateFileA("test.reg", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
lok(regfile != INVALID_HANDLE_VALUE, "Failed to create test.reg file\n");
if(regfile == INVALID_HANDLE_VALUE)
if (regfile == INVALID_HANDLE_VALUE)
{
HeapFree(GetProcessHeap(), 0, wstr);
return FALSE;
}
ret = WriteFile(regfile, wstr, memsize, &written, NULL);
lok(ret, "WriteFile failed: %u\n", GetLastError());