Marcus Meissner : winedbg: Close filehandle on one exit branch (Coverity).

Alexandre Julliard julliard at wine.codeweavers.com
Thu May 7 09:01:44 CDT 2015


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

Author: Marcus Meissner <marcus at jet.franken.de>
Date:   Thu May  7 10:39:20 2015 +0200

winedbg: Close filehandle on one exit branch (Coverity).

---

 programs/winedbg/source.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/programs/winedbg/source.c b/programs/winedbg/source.c
index e564815..c21336a 100644
--- a/programs/winedbg/source.c
+++ b/programs/winedbg/source.c
@@ -87,7 +87,10 @@ static  void*   source_map_file(const char* name, HANDLE* hMap, unsigned* size)
     hFile = CreateFileA(name, GENERIC_READ, FILE_SHARE_READ, NULL,
                         OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
     if (hFile == INVALID_HANDLE_VALUE) return (void*)-1;
-    if (size != NULL && (*size = GetFileSize(hFile, NULL)) == -1) return (void*)-1;
+    if (size != NULL && (*size = GetFileSize(hFile, NULL)) == INVALID_FILE_SIZE) {
+        CloseHandle(hFile);
+        return (void*)-1;
+    }
     *hMap = CreateFileMappingW(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
     CloseHandle(hFile);
     if (!*hMap) return (void*)-1;




More information about the wine-cvs mailing list