Only release object if we actually got it.

This commit is contained in:
Eric Pouech 2003-07-02 00:37:16 +00:00 committed by Alexandre Julliard
parent 86cb1cec75
commit 81e15c5ce0
1 changed files with 11 additions and 9 deletions

View File

@ -231,16 +231,18 @@ static void FillTreeView(IShellFolder * lpsf, LPITEMIDLIST pidl, HTREEITEM hPar
{ {
hr = IShellFolder_BindToObject(lpsf,pidlTemp,NULL,&IID_IShellFolder,(LPVOID*)&pSFChild); hr = IShellFolder_BindToObject(lpsf,pidlTemp,NULL,&IID_IShellFolder,(LPVOID*)&pSFChild);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{
hr = IShellFolder_EnumObjects(pSFChild, hwnd, BrowseFlagsToSHCONTF(lpBrowseInfo->ulFlags), &pEnumIL); hr = IShellFolder_EnumObjects(pSFChild, hwnd, BrowseFlagsToSHCONTF(lpBrowseInfo->ulFlags), &pEnumIL);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
if ((IEnumIDList_Skip(pEnumIL, 1) != S_OK) || FAILED(IEnumIDList_Reset(pEnumIL))) if ((IEnumIDList_Skip(pEnumIL, 1) != S_OK) || FAILED(IEnumIDList_Reset(pEnumIL)))
{ {
IEnumIDList_Release(pEnumIL); IEnumIDList_Release(pEnumIL);
pEnumIL = NULL; pEnumIL = NULL;
} }
} }
IShellFolder_Release(pSFChild); IShellFolder_Release(pSFChild);
}
} }
if (!(hPrev = InsertTreeViewItem(lpsf, pidlTemp, pidl, pEnumIL, hParent))) if (!(hPrev = InsertTreeViewItem(lpsf, pidlTemp, pidl, pEnumIL, hParent)))