diff --git a/dll/win32/browseui/addresseditbox.cpp b/dll/win32/browseui/addresseditbox.cpp index cec978c191e..7525dece84e 100644 --- a/dll/win32/browseui/addresseditbox.cpp +++ b/dll/win32/browseui/addresseditbox.cpp @@ -319,7 +319,14 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::Execute(long paramC) SHFree(pidl); if (hr == 0) + { + if (pidlLastParsed) + { + ILFree(pidlLastParsed); + pidlLastParsed = NULL; + } return S_OK; + } /* * Attempt to browse to the parsed pidl @@ -334,17 +341,38 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::Execute(long paramC) HWND topLevelWindow; hr = IUnknown_GetWindow(pisb, &topLevelWindow); if (FAILED(hr)) + { + if (pidlLastParsed) + { + ILFree(pidlLastParsed); + pidlLastParsed = NULL; + } return hr; + } LPCITEMIDLIST pidlChild; CComPtr sf; hr = SHBindToParent(pidlLastParsed, IID_PPV_ARG(IShellFolder, &sf), &pidlChild); if (FAILED(hr)) + { + if (pidlLastParsed) + { + ILFree(pidlLastParsed); + pidlLastParsed = NULL; + } return hr; + } hr = SHInvokeDefaultCommand(topLevelWindow, sf, pidlChild); if (FAILED(hr)) + { + if (pidlLastParsed) + { + ILFree(pidlLastParsed); + pidlLastParsed = NULL; + } return hr; + } return hr; }