Commit e0a97d32 authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

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

parent c618e994
...@@ -771,8 +771,11 @@ static BOOL test_import_wstr_(unsigned line, const char *file_contents, DWORD *r ...@@ -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());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment