shell32: Fixed a couple of FindFirstFile handle leaks.

This commit is contained in:
Alexandre Julliard 2006-01-27 15:48:29 +01:00
parent a76d5a10ed
commit d37a119ee6
1 changed files with 5 additions and 2 deletions

View File

@ -826,6 +826,7 @@ static BOOL add_file_to_entry(FILE_ENTRY *feFile, LPWSTR szFile, BOOL bFromWildc
{ {
DWORD dwLen = strlenW(szFile) + 1; DWORD dwLen = strlenW(szFile) + 1;
LPWSTR ptr; LPWSTR ptr;
HANDLE h;
feFile->szFullPath = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR)); feFile->szFullPath = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
strcpyW(feFile->szFullPath, szFile); strcpyW(feFile->szFullPath, szFile);
@ -843,8 +844,10 @@ static BOOL add_file_to_entry(FILE_ENTRY *feFile, LPWSTR szFile, BOOL bFromWildc
} }
feFile->bFromWildcard = bFromWildcard; 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)) if (IsAttribDir(feFile->wfd.dwFileAttributes))
return TRUE; return TRUE;
} }
@ -890,7 +893,7 @@ static void parse_wildcard_files(FILE_LIST *flList, LPWSTR szFile, LPDWORD pdwLi
flList->bAnyDirectories = TRUE; flList->bAnyDirectories = TRUE;
} }
CloseHandle(hFile); FindClose(hFile);
} }
/* takes the null-separated file list and fills out the FILE_LIST */ /* takes the null-separated file list and fills out the FILE_LIST */