Always free the library

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7288 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2021-07-29 12:11:36 +00:00
parent 0c964dbf0c
commit c28ef6a08b

View file

@ -310,7 +310,7 @@ static INT_PTR CALLBACK LookupDlgProc(HWND hDlg, UINT Msg, WPARAM WParam, LPARAM
break;
case LM_FMTMSG:
{
UINT flags = FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS;
UINT flags = FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, succ = false;
ULARGE_INTEGER li = PathParseIconLocationEx(buf);
LPCTSTR numstr = buf;
HMODULE hMod = 0;
@ -321,12 +321,11 @@ static INT_PTR CALLBACK LookupDlgProc(HWND hDlg, UINT Msg, WPARAM WParam, LPARAM
if (!hMod) goto badmsgmod;
}
hr = StrToSInt(numstr);
if (!FormatMessage(flags, hMod, hr, 0, buf, COUNTOF(buf), NULL)) badmsgmod:
{
hr = GetLastError();
goto die_hr;
}
succ = FormatMessage(flags, hMod, hr, 0, buf, COUNTOF(buf), NULL) != 0;
badmsgmod:
hr = GetLastError();
if (hMod) FreeLibrary(hMod);
if (!succ) goto die_hr;
SetWindowText(pDD->hOutTxt, buf);
}
break;