forked from Mirrors/wine-wine
comdlg32: Fix some leaks on error paths (Coverity).
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>oldstable
parent
855d7b0fd8
commit
ffd84dc429
|
@ -334,7 +334,7 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
|
||||||
UINT wFlags)
|
UINT wFlags)
|
||||||
{
|
{
|
||||||
HRESULT hRes;
|
HRESULT hRes;
|
||||||
IShellFolder *psfTmp;
|
IShellFolder *folder;
|
||||||
IShellView *psvTmp;
|
IShellView *psvTmp;
|
||||||
FileOpenDlgInfos *fodInfos;
|
FileOpenDlgInfos *fodInfos;
|
||||||
LPITEMIDLIST pidlTmp;
|
LPITEMIDLIST pidlTmp;
|
||||||
|
@ -356,7 +356,7 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
|
||||||
|
|
||||||
/* SBSP_RELATIVE A relative pidl (relative from the current folder) */
|
/* SBSP_RELATIVE A relative pidl (relative from the current folder) */
|
||||||
if (FAILED(hRes = IShellFolder_BindToObject(fodInfos->Shell.FOIShellFolder,
|
if (FAILED(hRes = IShellFolder_BindToObject(fodInfos->Shell.FOIShellFolder,
|
||||||
pidl, NULL, &IID_IShellFolder, (LPVOID *)&psfTmp)))
|
pidl, NULL, &IID_IShellFolder, (void **)&folder)))
|
||||||
{
|
{
|
||||||
ERR("bind to object failed\n");
|
ERR("bind to object failed\n");
|
||||||
return hRes;
|
return hRes;
|
||||||
|
@ -368,19 +368,19 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
|
||||||
{
|
{
|
||||||
/* Browse the parent folder (ignores the pidl) */
|
/* Browse the parent folder (ignores the pidl) */
|
||||||
pidlTmp = GetParentPidl(fodInfos->ShellInfos.pidlAbsCurrent);
|
pidlTmp = GetParentPidl(fodInfos->ShellInfos.pidlAbsCurrent);
|
||||||
psfTmp = GetShellFolderFromPidl(pidlTmp);
|
folder = GetShellFolderFromPidl(pidlTmp);
|
||||||
|
|
||||||
}
|
}
|
||||||
else /* SBSP_ABSOLUTE is 0x0000 */
|
else /* SBSP_ABSOLUTE is 0x0000 */
|
||||||
{
|
{
|
||||||
/* An absolute pidl (relative from the desktop) */
|
/* An absolute pidl (relative from the desktop) */
|
||||||
pidlTmp = ILClone(pidl);
|
pidlTmp = ILClone(pidl);
|
||||||
psfTmp = GetShellFolderFromPidl(pidlTmp);
|
folder = GetShellFolderFromPidl(pidlTmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!psfTmp)
|
if (!folder)
|
||||||
{
|
{
|
||||||
ERR("could not browse to folder\n");
|
ERR("could not browse to folder\n");
|
||||||
|
ILFree(pidlTmp);
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,10 +388,10 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
|
||||||
do nothing and pretend you did it*/
|
do nothing and pretend you did it*/
|
||||||
if (ILIsEqual(pidlTmp, fodInfos->ShellInfos.pidlAbsCurrent))
|
if (ILIsEqual(pidlTmp, fodInfos->ShellInfos.pidlAbsCurrent))
|
||||||
{
|
{
|
||||||
IShellFolder_Release(psfTmp);
|
IShellFolder_Release(folder);
|
||||||
ILFree(pidlTmp);
|
ILFree(pidlTmp);
|
||||||
TRACE("keep current folder\n");
|
TRACE("keep current folder\n");
|
||||||
return NOERROR;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Release the current DataObject */
|
/* Release the current DataObject */
|
||||||
|
@ -403,8 +403,13 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
|
||||||
|
|
||||||
/* Create the associated view */
|
/* Create the associated view */
|
||||||
TRACE("create view object\n");
|
TRACE("create view object\n");
|
||||||
if(FAILED(hRes = IShellFolder_CreateViewObject(psfTmp, fodInfos->ShellInfos.hwndOwner,
|
if (FAILED(hRes = IShellFolder_CreateViewObject(folder, fodInfos->ShellInfos.hwndOwner,
|
||||||
&IID_IShellView, (LPVOID *)&psvTmp))) goto error;
|
&IID_IShellView, (void **)&psvTmp)))
|
||||||
|
{
|
||||||
|
IShellFolder_Release(folder);
|
||||||
|
ILFree(pidlTmp);
|
||||||
|
return hRes;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if listview has focus */
|
/* Check if listview has focus */
|
||||||
bViewHasFocus = IsChild(fodInfos->ShellInfos.hwndView,GetFocus());
|
bViewHasFocus = IsChild(fodInfos->ShellInfos.hwndView,GetFocus());
|
||||||
|
@ -426,7 +431,7 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
|
||||||
/* Release old FOIShellFolder and update its value */
|
/* Release old FOIShellFolder and update its value */
|
||||||
if (fodInfos->Shell.FOIShellFolder)
|
if (fodInfos->Shell.FOIShellFolder)
|
||||||
IShellFolder_Release(fodInfos->Shell.FOIShellFolder);
|
IShellFolder_Release(fodInfos->Shell.FOIShellFolder);
|
||||||
fodInfos->Shell.FOIShellFolder = psfTmp;
|
fodInfos->Shell.FOIShellFolder = folder;
|
||||||
|
|
||||||
/* Release old pidlAbsCurrent and update its value */
|
/* Release old pidlAbsCurrent and update its value */
|
||||||
ILFree(fodInfos->ShellInfos.pidlAbsCurrent);
|
ILFree(fodInfos->ShellInfos.pidlAbsCurrent);
|
||||||
|
@ -441,7 +446,11 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
|
||||||
TRACE("create view window\n");
|
TRACE("create view window\n");
|
||||||
if (FAILED(hRes = IShellView_CreateViewWindow(psvTmp, NULL,
|
if (FAILED(hRes = IShellView_CreateViewWindow(psvTmp, NULL,
|
||||||
&fodInfos->ShellInfos.folderSettings, fodInfos->Shell.FOIShellBrowser,
|
&fodInfos->ShellInfos.folderSettings, fodInfos->Shell.FOIShellBrowser,
|
||||||
&rectView, &hwndView))) goto error;
|
&rectView, &hwndView)))
|
||||||
|
{
|
||||||
|
WARN("Failed to create view window, hr %#x.\n", hRes);
|
||||||
|
return hRes;
|
||||||
|
}
|
||||||
|
|
||||||
fodInfos->ShellInfos.hwndView = hwndView;
|
fodInfos->ShellInfos.hwndView = hwndView;
|
||||||
|
|
||||||
|
@ -461,9 +470,6 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
|
||||||
SetFocus(fodInfos->ShellInfos.hwndView);
|
SetFocus(fodInfos->ShellInfos.hwndView);
|
||||||
|
|
||||||
return hRes;
|
return hRes;
|
||||||
error:
|
|
||||||
ERR("Failed with error 0x%08x\n", hRes);
|
|
||||||
return hRes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
Loading…
Reference in New Issue