Only release object if we actually got it.
This commit is contained in:
parent
86cb1cec75
commit
81e15c5ce0
|
@ -231,16 +231,18 @@ static void FillTreeView(IShellFolder * lpsf, LPITEMIDLIST pidl, HTREEITEM hPar
|
|||
{
|
||||
hr = IShellFolder_BindToObject(lpsf,pidlTemp,NULL,&IID_IShellFolder,(LPVOID*)&pSFChild);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = IShellFolder_EnumObjects(pSFChild, hwnd, BrowseFlagsToSHCONTF(lpBrowseInfo->ulFlags), &pEnumIL);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
if ((IEnumIDList_Skip(pEnumIL, 1) != S_OK) || FAILED(IEnumIDList_Reset(pEnumIL)))
|
||||
{
|
||||
IEnumIDList_Release(pEnumIL);
|
||||
pEnumIL = NULL;
|
||||
}
|
||||
}
|
||||
IShellFolder_Release(pSFChild);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
if ((IEnumIDList_Skip(pEnumIL, 1) != S_OK) || FAILED(IEnumIDList_Reset(pEnumIL)))
|
||||
{
|
||||
IEnumIDList_Release(pEnumIL);
|
||||
pEnumIL = NULL;
|
||||
}
|
||||
}
|
||||
IShellFolder_Release(pSFChild);
|
||||
}
|
||||
}
|
||||
|
||||
if (!(hPrev = InsertTreeViewItem(lpsf, pidlTemp, pidl, pEnumIL, hParent)))
|
||||
|
|
Loading…
Reference in New Issue