From c28ef6a08b2b092c23405fd15d9ddc9be191497c Mon Sep 17 00:00:00 2001 From: anders_k Date: Thu, 29 Jul 2021 12:11:36 +0000 Subject: [PATCH] Always free the library git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7288 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/Makensisw/lookup.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Contrib/Makensisw/lookup.cpp b/Contrib/Makensisw/lookup.cpp index 1dcd6452..c279e5dd 100644 --- a/Contrib/Makensisw/lookup.cpp +++ b/Contrib/Makensisw/lookup.cpp @@ -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;