qedit/tests: Fix a file handle leak on error path (Coverity).

This commit is contained in:
Nikolay Sivov 2014-04-10 09:18:17 +04:00 committed by Alexandre Julliard
parent ed51082dd6
commit 4f681295d6

View File

@ -84,6 +84,7 @@ static BOOL unpack_avi_file(int id, WCHAR name[MAX_PATH])
char *mem;
DWORD size, written;
HANDLE fh;
BOOL ret;
res = FindResourceW(NULL, MAKEINTRESOURCEW(id), MAKEINTRESOURCEW(AVI_RES_TYPE));
if (!res)
@ -116,12 +117,9 @@ static BOOL unpack_avi_file(int id, WCHAR name[MAX_PATH])
if (fh == INVALID_HANDLE_VALUE)
return FALSE;
if (!WriteFile(fh, mem, size, &written, NULL) || written != size)
return FALSE;
ret = WriteFile(fh, mem, size, &written, NULL);
CloseHandle(fh);
return TRUE;
return ret && written == size;
}
static BOOL init_tests(void)