diff --git a/DuiLib/Core/UIRender.cpp b/DuiLib/Core/UIRender.cpp index 815c182b..0fea0d76 100644 --- a/DuiLib/Core/UIRender.cpp +++ b/DuiLib/Core/UIRender.cpp @@ -349,7 +349,11 @@ TImageInfo* CRenderEngine::LoadImage(STRINGorID bitmap, LPCTSTR type, DWORD mask FILE_ATTRIBUTE_NORMAL, NULL); if( hFile == INVALID_HANDLE_VALUE ) break; dwSize = ::GetFileSize(hFile, NULL); - if( dwSize == 0 ) break; + if (dwSize == 0) + { + ::CloseHandle(hFile); + break; + } DWORD dwRead = 0; pData = new BYTE[ dwSize ]; @@ -411,7 +415,11 @@ TImageInfo* CRenderEngine::LoadImage(STRINGorID bitmap, LPCTSTR type, DWORD mask FILE_ATTRIBUTE_NORMAL, NULL); if( hFile == INVALID_HANDLE_VALUE ) break; dwSize = ::GetFileSize(hFile, NULL); - if( dwSize == 0 ) break; + if (dwSize == 0) + { + ::CloseHandle(hFile); + break; + } DWORD dwRead = 0; pData = new BYTE[ dwSize ];