QuotePlugin: Fixed handle leak

This commit is contained in:
spx 2012-08-27 14:04:27 -07:00
parent a8dda05447
commit 1ba617d829

View File

@ -77,10 +77,10 @@ void ScanFolder(std::vector<std::wstring>& files, std::vector<std::wstring>& fil
std::wstring searchPath = path + L"*"; std::wstring searchPath = path + L"*";
hSearch = FindFirstFile(searchPath.c_str(), &fileData); hSearch = FindFirstFile(searchPath.c_str(), &fileData);
if (hSearch == INVALID_HANDLE_VALUE) return; // No more files found
do do
{ {
if (hSearch == INVALID_HANDLE_VALUE) break; // No more files found
if (fileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (fileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{ {
if (bSubfolders && if (bSubfolders &&
@ -110,6 +110,8 @@ void ScanFolder(std::vector<std::wstring>& files, std::vector<std::wstring>& fil
} }
} }
while (FindNextFile(hSearch, &fileData)); while (FindNextFile(hSearch, &fileData));
FindClose(hSearch);
} }
PLUGIN_EXPORT void Initialize(void** data, void* rm) PLUGIN_EXPORT void Initialize(void** data, void* rm)