janitorial: Remove redundant NULL checks before CoTaskMemFree (found by Smatch).
This commit is contained in:
parent
29a55bd512
commit
99e2c6dff2
|
@ -278,9 +278,7 @@ HRESULT WINAPI DllRegisterServer(void)
|
|||
if (hkeyClsid)
|
||||
RegCloseKey(hkeyClsid);
|
||||
|
||||
if (pszClsidDevMon)
|
||||
CoTaskMemFree(pszClsidDevMon);
|
||||
|
||||
CoUninitialize();
|
||||
|
||||
return res;
|
||||
|
|
|
@ -147,7 +147,6 @@ static HRESULT WINAPI DEVENUM_IParseDisplayName_ParseDisplayName(
|
|||
if (pEm)
|
||||
IEnumMoniker_Release(pEm);
|
||||
|
||||
if (pszClass)
|
||||
CoTaskMemFree(pszClass);
|
||||
|
||||
TRACE("-- returning: %lx\n", res);
|
||||
|
|
|
@ -121,11 +121,8 @@ HRESULT WINAPI MoFreeMediaType(DMO_MEDIA_TYPE* pmedia)
|
|||
pmedia->pUnk = NULL;
|
||||
}
|
||||
|
||||
if (pmedia->pbFormat)
|
||||
{
|
||||
CoTaskMemFree(pmedia->pbFormat);
|
||||
pmedia->pbFormat = NULL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -1726,7 +1726,6 @@ void CALLBACK ITypeInfo_ReleaseVarDesc_Proxy(
|
|||
{
|
||||
TRACE("(%p, %p)\n", This, pVarDesc);
|
||||
|
||||
if(pVarDesc->lpstrSchema)
|
||||
CoTaskMemFree(pVarDesc->lpstrSchema);
|
||||
|
||||
if(pVarDesc->varkind == VAR_CONST)
|
||||
|
|
|
@ -46,12 +46,10 @@ HRESULT CopyMediaType(AM_MEDIA_TYPE * pDest, const AM_MEDIA_TYPE *pSrc)
|
|||
}
|
||||
|
||||
void FreeMediaType(AM_MEDIA_TYPE * pMediaType)
|
||||
{
|
||||
if (pMediaType->pbFormat)
|
||||
{
|
||||
CoTaskMemFree(pMediaType->pbFormat);
|
||||
pMediaType->pbFormat = NULL;
|
||||
}
|
||||
|
||||
if (pMediaType->pUnk)
|
||||
{
|
||||
IUnknown_Release(pMediaType->pUnk);
|
||||
|
|
|
@ -620,11 +620,10 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi
|
|||
IPin_Release(This->pOutputPin);
|
||||
This->pOutputPin = NULL;
|
||||
}
|
||||
if (This->pszFileName)
|
||||
{
|
||||
|
||||
CoTaskMemFree(This->pszFileName);
|
||||
This->pszFileName = NULL;
|
||||
}
|
||||
|
||||
CloseHandle(hFile);
|
||||
}
|
||||
|
||||
|
@ -1079,12 +1078,8 @@ static HRESULT WINAPI FileAsyncReader_WaitForNext(IAsyncReader * iface, DWORD dw
|
|||
*pdwUser = pDataRq->dwUserData;
|
||||
}
|
||||
|
||||
/* clean up */
|
||||
if (pDataRq)
|
||||
{
|
||||
/* no need to close event handle since we will close it when the pin is destroyed */
|
||||
CoTaskMemFree(pDataRq);
|
||||
}
|
||||
|
||||
TRACE("-- %lx\n", hr);
|
||||
return hr;
|
||||
|
|
|
@ -152,7 +152,6 @@ static int find_data(struct Vector * v, const BYTE * pData, int size)
|
|||
|
||||
static void delete_vector(struct Vector * v)
|
||||
{
|
||||
if (v->pData)
|
||||
CoTaskMemFree(v->pData);
|
||||
v->current = 0;
|
||||
v->capacity = 0;
|
||||
|
@ -288,10 +287,7 @@ static HRESULT WINAPI FilterMapper2_CreateCategory(
|
|||
}
|
||||
|
||||
CloseHandle(hKey);
|
||||
|
||||
if (wClsidCategory)
|
||||
CoTaskMemFree(wClsidCategory);
|
||||
if (wClsidAMCat)
|
||||
CoTaskMemFree(wClsidAMCat);
|
||||
|
||||
return hr;
|
||||
|
@ -336,9 +332,7 @@ static HRESULT WINAPI FilterMapper2_UnregisterFilter(
|
|||
hr = HRESULT_FROM_WIN32(lRet);
|
||||
}
|
||||
|
||||
if (wClsidCategory)
|
||||
CoTaskMemFree(wClsidCategory);
|
||||
if (wFilter)
|
||||
CoTaskMemFree(wFilter);
|
||||
|
||||
return hr;
|
||||
|
@ -368,7 +362,6 @@ static HRESULT FM2_WriteClsid(IPropertyBag * pPropBag, REFCLSID clsid)
|
|||
V_UNION(&var, bstrVal) = wszClsid;
|
||||
hr = IPropertyBag_Write(pPropBag, wszClsidName, &var);
|
||||
}
|
||||
if (wszClsid)
|
||||
CoTaskMemFree(wszClsid);
|
||||
return hr;
|
||||
}
|
||||
|
@ -747,12 +740,10 @@ static HRESULT WINAPI FilterMapper2_RegisterFilter(
|
|||
if (szInstance)
|
||||
strcpyW(pCurrent+1, szInstance);
|
||||
else
|
||||
{
|
||||
if (szClsidTemp)
|
||||
{
|
||||
CoTaskMemFree(szClsidTemp);
|
||||
szClsidTemp = NULL;
|
||||
}
|
||||
|
||||
hr = StringFromCLSID(clsidFilter, &szClsidTemp);
|
||||
if (SUCCEEDED(hr))
|
||||
strcpyW(pCurrent+1, szClsidTemp);
|
||||
|
@ -787,7 +778,6 @@ static HRESULT WINAPI FilterMapper2_RegisterFilter(
|
|||
|
||||
if (pPropBag)
|
||||
IPropertyBag_Release(pPropBag);
|
||||
if (szClsidTemp)
|
||||
CoTaskMemFree(szClsidTemp);
|
||||
|
||||
if (SUCCEEDED(hr) && ppMoniker)
|
||||
|
@ -795,7 +785,6 @@ static HRESULT WINAPI FilterMapper2_RegisterFilter(
|
|||
else if (pMoniker)
|
||||
IMoniker_Release(pMoniker);
|
||||
|
||||
if (pregfp2)
|
||||
CoTaskMemFree(pregfp2);
|
||||
|
||||
TRACE("-- returning %lx\n", hr);
|
||||
|
@ -1360,7 +1349,6 @@ static HRESULT WINAPI FilterMapper_RegisterPin(
|
|||
hr = HRESULT_FROM_WIN32(lRet);
|
||||
}
|
||||
|
||||
if (wszClsid)
|
||||
CoTaskMemFree(wszClsid);
|
||||
if (hKey)
|
||||
CloseHandle(hKey);
|
||||
|
@ -1437,11 +1425,8 @@ static HRESULT WINAPI FilterMapper_RegisterPinType(
|
|||
CloseHandle(hKey);
|
||||
}
|
||||
|
||||
if (wszClsid)
|
||||
CoTaskMemFree(wszClsid);
|
||||
if (wszClsidMajorType)
|
||||
CoTaskMemFree(wszClsidMajorType);
|
||||
if (wszClsidSubType)
|
||||
CoTaskMemFree(wszClsidSubType);
|
||||
|
||||
return hr;
|
||||
|
@ -1488,7 +1473,6 @@ static HRESULT WINAPI FilterMapper_UnregisterFilter(IFilterMapper * iface, CLSID
|
|||
CloseHandle(hKey);
|
||||
}
|
||||
|
||||
if (wszClsid)
|
||||
CoTaskMemFree(wszClsid);
|
||||
|
||||
return hr;
|
||||
|
@ -1546,7 +1530,6 @@ static HRESULT WINAPI FilterMapper_UnregisterPin(IFilterMapper * iface, CLSID Fi
|
|||
CoTaskMemFree(wszPinNameKey);
|
||||
}
|
||||
|
||||
if (wszClsid)
|
||||
CoTaskMemFree(wszClsid);
|
||||
if (hKey)
|
||||
CloseHandle(hKey);
|
||||
|
|
Loading…
Reference in New Issue