janitorial: Remove redundant NULL checks before SHFree.
This commit is contained in:
parent
99e2c6dff2
commit
7b89ff88e8
|
@ -354,9 +354,7 @@ static void FillTreeView( browse_info *info, IShellFolder * lpsf,
|
|||
done:
|
||||
ReleaseCapture();
|
||||
SetCursor(LoadCursorW(0, (LPWSTR)IDC_ARROW));
|
||||
|
||||
if (pidlTemp)
|
||||
SHFree(pidlTemp);
|
||||
SHFree(pidlTemp);
|
||||
}
|
||||
|
||||
static inline BOOL PIDLIsType(LPCITEMIDLIST pidl, PIDLTYPE type)
|
||||
|
|
|
@ -402,8 +402,8 @@ void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID
|
|||
/* if we allocated it, free it. The ANSI flag is also set in its Unicode sibling. */
|
||||
if ((typeFlag & SHCNF_PATHA) || (typeFlag & SHCNF_PRINTERA))
|
||||
{
|
||||
if (Pidls[0]) SHFree((LPITEMIDLIST)Pidls[0]);
|
||||
if (Pidls[1]) SHFree((LPITEMIDLIST)Pidls[1]);
|
||||
SHFree((LPITEMIDLIST)Pidls[0]);
|
||||
SHFree((LPITEMIDLIST)Pidls[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -203,8 +203,7 @@ static ULONG WINAPI ISF_ControlPanel_fnRelease(IShellFolder2 * iface)
|
|||
|
||||
if (!refCount) {
|
||||
TRACE("-- destroying IShellFolder(%p)\n", This);
|
||||
if (This->pidlRoot)
|
||||
SHFree(This->pidlRoot);
|
||||
SHFree(This->pidlRoot);
|
||||
LocalFree((HLOCAL) This);
|
||||
}
|
||||
return refCount;
|
||||
|
|
|
@ -97,10 +97,7 @@ static ULONG WINAPI IEnumFORMATETC_fnRelease(LPENUMFORMATETC iface)
|
|||
if (!refCount)
|
||||
{
|
||||
TRACE(" destroying IEnumFORMATETC(%p)\n",This);
|
||||
if (This->pFmt)
|
||||
{
|
||||
SHFree (This->pFmt);
|
||||
}
|
||||
SHFree (This->pFmt);
|
||||
HeapFree(GetProcessHeap(),0,This);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -291,11 +291,8 @@ HRESULT WINAPI ILLoadFromStream (IStream * pStream, LPITEMIDLIST * ppPidl)
|
|||
|
||||
TRACE_(shell)("%p %p\n", pStream , ppPidl);
|
||||
|
||||
if (*ppPidl)
|
||||
{
|
||||
SHFree(*ppPidl);
|
||||
*ppPidl = NULL;
|
||||
}
|
||||
SHFree(*ppPidl);
|
||||
*ppPidl = NULL;
|
||||
|
||||
IStream_AddRef (pStream);
|
||||
|
||||
|
@ -865,8 +862,7 @@ LPITEMIDLIST WINAPI ILAppend(LPITEMIDLIST pidl, LPCITEMIDLIST item, BOOL bEnd)
|
|||
if (_ILIsDesktop(pidl))
|
||||
{
|
||||
idlRet = ILClone(item);
|
||||
if (pidl)
|
||||
SHFree (pidl);
|
||||
SHFree (pidl);
|
||||
return idlRet;
|
||||
}
|
||||
|
||||
|
@ -896,8 +892,7 @@ LPITEMIDLIST WINAPI ILAppend(LPITEMIDLIST pidl, LPCITEMIDLIST item, BOOL bEnd)
|
|||
void WINAPI ILFree(LPITEMIDLIST pidl)
|
||||
{
|
||||
TRACE("(pidl=%p)\n",pidl);
|
||||
if (pidl)
|
||||
SHFree(pidl);
|
||||
SHFree(pidl);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
|
|
|
@ -628,10 +628,10 @@ HINSTANCE16 WINAPI ShellExecute16( HWND16 hWnd, LPCSTR lpOperation,
|
|||
|
||||
SHELL_execute( &seiW, SHELL_Execute16 );
|
||||
|
||||
if (wVerb) SHFree(wVerb);
|
||||
if (wFile) SHFree(wFile);
|
||||
if (wParameters) SHFree(wParameters);
|
||||
if (wDirectory) SHFree(wDirectory);
|
||||
SHFree(wVerb);
|
||||
SHFree(wFile);
|
||||
SHFree(wParameters);
|
||||
SHFree(wDirectory);
|
||||
|
||||
return HINSTANCE_16(seiW.hInstApp);
|
||||
}
|
||||
|
|
|
@ -614,8 +614,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
|
|||
if (hr != S_OK)
|
||||
ret = FALSE;
|
||||
|
||||
if (pidlLast)
|
||||
SHFree(pidlLast);
|
||||
SHFree(pidlLast);
|
||||
|
||||
#ifdef MORE_DEBUG
|
||||
TRACE ("icon=%p index=0x%08x attr=0x%08lx name=%s type=%s ret=0x%08lx\n",
|
||||
|
|
|
@ -137,10 +137,8 @@ static ULONG WINAPI ISF_Desktop_fnRelease (IShellFolder2 * iface)
|
|||
if (!refCount)
|
||||
{
|
||||
TRACE ("-- destroying IShellFolder(%p)\n", This);
|
||||
if (This->pidlRoot)
|
||||
SHFree (This->pidlRoot);
|
||||
if (This->sPathTarget)
|
||||
SHFree (This->sPathTarget);
|
||||
SHFree (This->pidlRoot);
|
||||
SHFree (This->sPathTarget);
|
||||
LocalFree ((HLOCAL) This);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -194,10 +194,8 @@ static ULONG WINAPI IUnknown_fnRelease (IUnknown * iface)
|
|||
if (!refCount) {
|
||||
TRACE ("-- destroying IShellFolder(%p)\n", This);
|
||||
|
||||
if (This->pidlRoot)
|
||||
SHFree (This->pidlRoot);
|
||||
if (This->sPathTarget)
|
||||
SHFree (This->sPathTarget);
|
||||
SHFree (This->pidlRoot);
|
||||
SHFree (This->sPathTarget);
|
||||
LocalFree ((HLOCAL) This);
|
||||
}
|
||||
return refCount;
|
||||
|
@ -1380,15 +1378,11 @@ IFSFldr_PersistFolder3_Initialize (IPersistFolder3 * iface, LPCITEMIDLIST pidl)
|
|||
|
||||
TRACE ("(%p)->(%p)\n", This, pidl);
|
||||
|
||||
if (This->pidlRoot)
|
||||
SHFree (This->pidlRoot); /* free the old pidl */
|
||||
SHFree (This->pidlRoot); /* free the old pidl */
|
||||
This->pidlRoot = ILClone (pidl); /* set my pidl */
|
||||
|
||||
if (This->sPathTarget)
|
||||
{
|
||||
SHFree (This->sPathTarget);
|
||||
This->sPathTarget = NULL;
|
||||
}
|
||||
SHFree (This->sPathTarget);
|
||||
This->sPathTarget = NULL;
|
||||
|
||||
/* set my path */
|
||||
if (SHGetPathFromIDListW (pidl, wszTemp)) {
|
||||
|
|
|
@ -186,8 +186,7 @@ static ULONG WINAPI ISF_MyComputer_fnRelease (IShellFolder2 * iface)
|
|||
if (!refCount)
|
||||
{
|
||||
TRACE ("-- destroying IShellFolder(%p)\n", This);
|
||||
if (This->pidlRoot)
|
||||
SHFree (This->pidlRoot);
|
||||
SHFree (This->pidlRoot);
|
||||
LocalFree ((HLOCAL) This);
|
||||
}
|
||||
return refCount;
|
||||
|
|
|
@ -882,8 +882,8 @@ HINSTANCE WINAPI FindExecutableA(LPCSTR lpFile, LPCSTR lpDirectory, LPSTR lpResu
|
|||
|
||||
retval = FindExecutableW(wFile, wDirectory, wResult);
|
||||
WideCharToMultiByte(CP_ACP, 0, wResult, -1, lpResult, MAX_PATH, NULL, NULL);
|
||||
if (wFile) SHFree( wFile );
|
||||
if (wDirectory) SHFree( wDirectory );
|
||||
SHFree( wFile );
|
||||
SHFree( wDirectory );
|
||||
|
||||
TRACE("returning %s\n", lpResult);
|
||||
return retval;
|
||||
|
@ -1580,11 +1580,11 @@ BOOL WINAPI ShellExecuteExA (LPSHELLEXECUTEINFOA sei)
|
|||
if (sei->fMask & SEE_MASK_NOCLOSEPROCESS)
|
||||
sei->hProcess = seiW.hProcess;
|
||||
|
||||
if (wVerb) SHFree(wVerb);
|
||||
if (wFile) SHFree(wFile);
|
||||
if (wParameters) SHFree(wParameters);
|
||||
if (wDirectory) SHFree(wDirectory);
|
||||
if (wClass) SHFree(wClass);
|
||||
SHFree(wVerb);
|
||||
SHFree(wFile);
|
||||
SHFree(wParameters);
|
||||
SHFree(wDirectory);
|
||||
SHFree(wClass);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -115,9 +115,7 @@ static LPFMINFO FM_SetMenuParameter(
|
|||
|
||||
menudata = FM_GetMenuInfo(hmenu);
|
||||
|
||||
if ( menudata->pidl)
|
||||
{ SHFree(menudata->pidl);
|
||||
}
|
||||
SHFree(menudata->pidl);
|
||||
|
||||
menudata->uID = uID;
|
||||
menudata->pidl = ILClone(pidl);
|
||||
|
@ -299,9 +297,7 @@ void WINAPI FileMenu_Destroy (HMENU hmenu)
|
|||
|
||||
menudata = FM_GetMenuInfo(hmenu);
|
||||
|
||||
if ( menudata->pidl)
|
||||
{ SHFree( menudata->pidl);
|
||||
}
|
||||
SHFree( menudata->pidl);
|
||||
HeapFree(GetProcessHeap(), 0, menudata);
|
||||
|
||||
DestroyMenu (hmenu);
|
||||
|
@ -692,8 +688,7 @@ BOOL WINAPI FileMenu_DeleteAllItems (HMENU hmenu)
|
|||
for (i = 0; i < GetMenuItemCount( hmenu ); i++)
|
||||
{ GetMenuItemInfoW(hmenu, i, TRUE, &mii );
|
||||
|
||||
if (mii.dwItemData)
|
||||
SHFree((LPFMINFO)mii.dwItemData);
|
||||
SHFree((LPFMINFO)mii.dwItemData);
|
||||
|
||||
if (mii.hSubMenu)
|
||||
FileMenu_Destroy(mii.hSubMenu);
|
||||
|
|
|
@ -811,10 +811,7 @@ static UINT ShellView_GetSelections(IShellViewImpl * This)
|
|||
LVITEMA lvItem;
|
||||
UINT i = 0;
|
||||
|
||||
if (This->apidl)
|
||||
{
|
||||
SHFree(This->apidl);
|
||||
}
|
||||
SHFree(This->apidl);
|
||||
|
||||
This->cidl = ListView_GetSelectedCount(This->hWndList);
|
||||
This->apidl = (LPITEMIDLIST*)SHAlloc(This->cidl * sizeof(LPITEMIDLIST));
|
||||
|
@ -1713,8 +1710,7 @@ static ULONG WINAPI IShellView_fnRelease(IShellView * iface)
|
|||
if(This->pSF2Parent)
|
||||
IShellFolder2_Release(This->pSF2Parent);
|
||||
|
||||
if(This->apidl)
|
||||
SHFree(This->apidl);
|
||||
SHFree(This->apidl);
|
||||
|
||||
if(This->pAdvSink)
|
||||
IAdviseSink_Release(This->pAdvSink);
|
||||
|
|
|
@ -166,8 +166,7 @@ static ULONG WINAPI ISvItemCm_fnRelease(IContextMenu2 *iface)
|
|||
if(This->pSFParent)
|
||||
IShellFolder_Release(This->pSFParent);
|
||||
|
||||
if(This->pidl)
|
||||
SHFree(This->pidl);
|
||||
SHFree(This->pidl);
|
||||
|
||||
/*make sure the pidl is freed*/
|
||||
_ILFreeaPidl(This->apidl, This->cidl);
|
||||
|
|
|
@ -377,8 +377,7 @@ HRESULT TRASH_UnpackItemID(LPCSHITEMID id, TRASH_ELEMENT *element, WIN32_FIND_DA
|
|||
|
||||
void TRASH_DisposeElement(TRASH_ELEMENT *element)
|
||||
{
|
||||
if (element)
|
||||
SHFree(element->filename);
|
||||
SHFree(element->filename);
|
||||
}
|
||||
|
||||
HRESULT TRASH_GetDetails(const TRASH_ELEMENT *element, WIN32_FIND_DATAW *data)
|
||||
|
|
Loading…
Reference in New Issue