[PATCH] scrrun: added missing FindClose in error case (Coverity)

Marcus Meissner marcus at jet.franken.de
Sat Aug 17 02:37:04 CDT 2013


1060206 Resource leak
1060208 Resource leak
1060209 Resource leak
---
 dlls/scrrun/filesystem.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/dlls/scrrun/filesystem.c b/dlls/scrrun/filesystem.c
index 19f5f2b..2750108 100644
--- a/dlls/scrrun/filesystem.c
+++ b/dlls/scrrun/filesystem.c
@@ -1375,8 +1375,10 @@ static inline HRESULT delete_file(const WCHAR *file, DWORD file_len, VARIANT_BOO
         return create_error(GetLastError());
 
     len = get_parent_folder_name(file, file_len);
-    if(len+1 >= MAX_PATH)
+    if(len+1 >= MAX_PATH) {
+        FindClose(f);
         return E_FAIL;
+    }
     if(len) {
         memcpy(path, file, len*sizeof(WCHAR));
         path[len++] = '\\';
@@ -1432,8 +1434,10 @@ static HRESULT delete_folder(const WCHAR *folder, DWORD folder_len, VARIANT_BOOL
         return create_error(GetLastError());
 
     len = get_parent_folder_name(folder, folder_len);
-    if(len+1 >= MAX_PATH)
+    if(len+1 >= MAX_PATH) {
+        FindClose(f);
         return E_FAIL;
+    }
     if(len) {
         memcpy(path, folder, len*sizeof(WCHAR));
         path[len++] = '\\';
@@ -1547,8 +1551,10 @@ static inline HRESULT copy_file(const WCHAR *source, DWORD source_len,
     }
 
     dst_len = destination_len;
-    if(dst_len+1 >= MAX_PATH)
+    if(dst_len+1 >= MAX_PATH) {
+        FindClose(f);
         return E_FAIL;
+    }
     memcpy(dst_path, destination, dst_len*sizeof(WCHAR));
     if(dst_path[dst_len-1]!= '\\' && dst_path[dst_len-1]!='/')
         dst_path[dst_len++] = '\\';
-- 
1.7.10.4




More information about the wine-patches mailing list