Commit 7b89ff88 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

janitorial: Remove redundant NULL checks before SHFree.

parent 99e2c6df
......@@ -354,8 +354,6 @@ static void FillTreeView( browse_info *info, IShellFolder * lpsf,
done:
ReleaseCapture();
SetCursor(LoadCursorW(0, (LPWSTR)IDC_ARROW));
if (pidlTemp)
SHFree(pidlTemp);
}
......
......@@ -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,7 +203,6 @@ static ULONG WINAPI ISF_ControlPanel_fnRelease(IShellFolder2 * iface)
if (!refCount) {
TRACE("-- destroying IShellFolder(%p)\n", This);
if (This->pidlRoot)
SHFree(This->pidlRoot);
LocalFree((HLOCAL) This);
}
......
......@@ -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);
}
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;
}
IStream_AddRef (pStream);
......@@ -865,7 +862,6 @@ LPITEMIDLIST WINAPI ILAppend(LPITEMIDLIST pidl, LPCITEMIDLIST item, BOOL bEnd)
if (_ILIsDesktop(pidl))
{
idlRet = ILClone(item);
if (pidl)
SHFree (pidl);
return idlRet;
}
......@@ -896,7 +892,6 @@ LPITEMIDLIST WINAPI ILAppend(LPITEMIDLIST pidl, LPCITEMIDLIST item, BOOL bEnd)
void WINAPI ILFree(LPITEMIDLIST pidl)
{
TRACE("(pidl=%p)\n",pidl);
if (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,7 +614,6 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
if (hr != S_OK)
ret = FALSE;
if (pidlLast)
SHFree(pidlLast);
#ifdef MORE_DEBUG
......
......@@ -137,9 +137,7 @@ 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);
LocalFree ((HLOCAL) This);
return 0;
......
......@@ -194,9 +194,7 @@ 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);
LocalFree ((HLOCAL) This);
}
......@@ -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 */
This->pidlRoot = ILClone (pidl); /* set my pidl */
if (This->sPathTarget)
{
SHFree (This->sPathTarget);
This->sPathTarget = NULL;
}
/* set my path */
if (SHGetPathFromIDListW (pidl, wszTemp)) {
......
......@@ -186,7 +186,6 @@ static ULONG WINAPI ISF_MyComputer_fnRelease (IShellFolder2 * iface)
if (!refCount)
{
TRACE ("-- destroying IShellFolder(%p)\n", This);
if (This->pidlRoot)
SHFree (This->pidlRoot);
LocalFree ((HLOCAL) This);
}
......
......@@ -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,7 +688,6 @@ 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);
if (mii.hSubMenu)
......
......@@ -811,10 +811,7 @@ static UINT ShellView_GetSelections(IShellViewImpl * This)
LVITEMA lvItem;
UINT i = 0;
if (This->apidl)
{
SHFree(This->apidl);
}
This->cidl = ListView_GetSelectedCount(This->hWndList);
This->apidl = (LPITEMIDLIST*)SHAlloc(This->cidl * sizeof(LPITEMIDLIST));
......@@ -1713,7 +1710,6 @@ static ULONG WINAPI IShellView_fnRelease(IShellView * iface)
if(This->pSF2Parent)
IShellFolder2_Release(This->pSF2Parent);
if(This->apidl)
SHFree(This->apidl);
if(This->pAdvSink)
......
......@@ -166,7 +166,6 @@ static ULONG WINAPI ISvItemCm_fnRelease(IContextMenu2 *iface)
if(This->pSFParent)
IShellFolder_Release(This->pSFParent);
if(This->pidl)
SHFree(This->pidl);
/*make sure the pidl is freed*/
......
......@@ -377,7 +377,6 @@ HRESULT TRASH_UnpackItemID(LPCSHITEMID id, TRASH_ELEMENT *element, WIN32_FIND_DA
void TRASH_DisposeElement(TRASH_ELEMENT *element)
{
if (element)
SHFree(element->filename);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment