Alexandre Julliard : shell32: Fixed a couple of FindFirstFile handle leaks.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jan 27 09:19:15 CST 2006


Module: wine
Branch: refs/heads/master
Commit: d37a119ee66ad43099791605a748013ec69c7e2f
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=d37a119ee66ad43099791605a748013ec69c7e2f

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Jan 27 15:48:29 2006 +0100

shell32: Fixed a couple of FindFirstFile handle leaks.

---

 dlls/shell32/shlfileop.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c
index 905a9c1..e12df61 100644
--- a/dlls/shell32/shlfileop.c
+++ b/dlls/shell32/shlfileop.c
@@ -826,6 +826,7 @@ static BOOL add_file_to_entry(FILE_ENTRY
 {
     DWORD dwLen = strlenW(szFile) + 1;
     LPWSTR ptr;
+    HANDLE h;
 
     feFile->szFullPath = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
     strcpyW(feFile->szFullPath, szFile);
@@ -843,8 +844,10 @@ static BOOL add_file_to_entry(FILE_ENTRY
     }
 
     feFile->bFromWildcard = bFromWildcard;
-    if (FindFirstFileW(feFile->szFullPath, &feFile->wfd) != INVALID_HANDLE_VALUE)
+    h = FindFirstFileW(feFile->szFullPath, &feFile->wfd);
+    if (h != INVALID_HANDLE_VALUE)
     {
+        FindClose(h);
         if (IsAttribDir(feFile->wfd.dwFileAttributes))
             return TRUE;
     }
@@ -890,7 +893,7 @@ static void parse_wildcard_files(FILE_LI
             flList->bAnyDirectories = TRUE;
     }
 
-    CloseHandle(hFile);
+    FindClose(hFile);
 }
 
 /* takes the null-separated file list and fills out the FILE_LIST */




More information about the wine-cvs mailing list