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
1 changed files with 3 additions and 5 deletions

View File

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