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

Alexandre Julliard julliard at winehq.org
Thu Apr 10 12:21:27 CDT 2014


Module: wine
Branch: master
Commit: 4f681295d6844fa70eb58b84757779b8a7638c99
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4f681295d6844fa70eb58b84757779b8a7638c99

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Apr 10 09:18:17 2014 +0400

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

---

 dlls/qedit/tests/mediadet.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/dlls/qedit/tests/mediadet.c b/dlls/qedit/tests/mediadet.c
index fce3e97..d5efe43 100644
--- a/dlls/qedit/tests/mediadet.c
+++ b/dlls/qedit/tests/mediadet.c
@@ -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)




More information about the wine-cvs mailing list