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:
parent
c618e99475
commit
e0a97d32e2
|
@ -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,
|
regfile = CreateFileA("test.reg", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
|
||||||
FILE_ATTRIBUTE_NORMAL, NULL);
|
FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
lok(regfile != INVALID_HANDLE_VALUE, "Failed to create test.reg file\n");
|
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;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
ret = WriteFile(regfile, wstr, memsize, &written, NULL);
|
ret = WriteFile(regfile, wstr, memsize, &written, NULL);
|
||||||
lok(ret, "WriteFile failed: %u\n", GetLastError());
|
lok(ret, "WriteFile failed: %u\n", GetLastError());
|
||||||
|
|
Loading…
Reference in New Issue