txt: free already loaded libraries on LoadLibraryW() failure
This fixes a future "Resource leak" cppcheck error.
This commit is contained in:
parent
173300a37b
commit
59f737ad1b
1 changed files with 10 additions and 3 deletions
|
|
@ -175,14 +175,21 @@ static BOOL (*MySHGetPathFromIDList)(LPITEMIDLIST, LPTSTR) = NULL;
|
|||
|
||||
static int LoadDLLs(void)
|
||||
{
|
||||
HMODULE comdlg32 = LoadLibraryW(L"comdlg32.dll");
|
||||
HMODULE shell32 = LoadLibraryW(L"shell32.dll");
|
||||
HMODULE comdlg32, shell32
|
||||
|
||||
if (comdlg32 == NULL || shell32 == NULL)
|
||||
comdlg32 = LoadLibraryW(L"comdlg32.dll");
|
||||
if (comdlg32 == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
shell32 = LoadLibraryW(L"shell32.dll");
|
||||
if (shell32 == NULL)
|
||||
{
|
||||
FreeLibrary(comdlg32);
|
||||
return 0;
|
||||
}
|
||||
|
||||
MyGetOpenFileName =
|
||||
(void *) GetProcAddress(comdlg32, "GetOpenFileNameA");
|
||||
MySHBrowseForFolder =
|
||||
|
|
|
|||
Loading…
Reference in a new issue