janitorial: Remove redundant NULL pointer checks before HeapFree'ing them.
Some HeapFree's are hidden behind macros. Found by smatch.
This commit is contained in:
parent
9d4960bfcb
commit
a87520036f
27 changed files with 46 additions and 92 deletions
|
@ -1455,7 +1455,7 @@ LONG WINAPI RegGetValueW( HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue,
|
|||
(dwType == REG_EXPAND_SZ && !(dwFlags & RRF_NOEXPAND)))
|
||||
{
|
||||
do {
|
||||
if (pvBuf) HeapFree(GetProcessHeap(), 0, pvBuf);
|
||||
HeapFree(GetProcessHeap(), 0, pvBuf);
|
||||
|
||||
pvBuf = HeapAlloc(GetProcessHeap(), 0, cbData);
|
||||
if (!pvBuf)
|
||||
|
@ -1494,7 +1494,7 @@ LONG WINAPI RegGetValueW( HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue,
|
|||
CopyMemory(pvData, pvBuf, *pcbData);
|
||||
}
|
||||
|
||||
if (pvBuf) HeapFree(GetProcessHeap(), 0, pvBuf);
|
||||
HeapFree(GetProcessHeap(), 0, pvBuf);
|
||||
}
|
||||
|
||||
if (pszSubKey && pszSubKey[0])
|
||||
|
@ -1547,7 +1547,7 @@ LONG WINAPI RegGetValueA( HKEY hKey, LPCSTR pszSubKey, LPCSTR pszValue,
|
|||
(dwType == REG_EXPAND_SZ && !(dwFlags & RRF_NOEXPAND)))
|
||||
{
|
||||
do {
|
||||
if (pvBuf) HeapFree(GetProcessHeap(), 0, pvBuf);
|
||||
HeapFree(GetProcessHeap(), 0, pvBuf);
|
||||
|
||||
pvBuf = HeapAlloc(GetProcessHeap(), 0, cbData);
|
||||
if (!pvBuf)
|
||||
|
@ -1586,7 +1586,7 @@ LONG WINAPI RegGetValueA( HKEY hKey, LPCSTR pszSubKey, LPCSTR pszValue,
|
|||
CopyMemory(pvData, pvBuf, *pcbData);
|
||||
}
|
||||
|
||||
if (pvBuf) HeapFree(GetProcessHeap(), 0, pvBuf);
|
||||
HeapFree(GetProcessHeap(), 0, pvBuf);
|
||||
}
|
||||
|
||||
if (pszSubKey && pszSubKey[0])
|
||||
|
|
|
@ -1841,9 +1841,7 @@ LookupAccountNameA(
|
|||
|
||||
RtlFreeUnicodeString(&lpSystemW);
|
||||
RtlFreeUnicodeString(&lpAccountW);
|
||||
|
||||
if (lpReferencedDomainNameW)
|
||||
HeapFree(GetProcessHeap(), 0, lpReferencedDomainNameW);
|
||||
HeapFree(GetProcessHeap(), 0, lpReferencedDomainNameW);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -1284,9 +1284,7 @@ static BOOL AVISaveOptionsFmtChoose(HWND hWnd)
|
|||
if (ret == S_OK)
|
||||
pOptions->dwFlags |= AVICOMPRESSF_VALID;
|
||||
|
||||
if (afmtc.pwfxEnum != NULL)
|
||||
HeapFree(GetProcessHeap(), 0, afmtc.pwfxEnum);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, afmtc.pwfxEnum);
|
||||
return (ret == S_OK ? TRUE : FALSE);
|
||||
} else {
|
||||
ERR(": unknown streamtype 0x%08lX\n", sInfo.fccType);
|
||||
|
@ -2007,8 +2005,7 @@ HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
|
|||
}
|
||||
|
||||
error:
|
||||
if (lpBuffer != NULL)
|
||||
HeapFree(GetProcessHeap(), 0, lpBuffer);
|
||||
HeapFree(GetProcessHeap(), 0, lpBuffer);
|
||||
if (pfile != NULL) {
|
||||
for (curStream = 0; curStream < nStreams; curStream++) {
|
||||
if (pOutStreams[curStream] != NULL)
|
||||
|
|
|
@ -1964,8 +1964,7 @@ static HRESULT AVIFILE_LoadIndex(IAVIFileImpl *This, DWORD size, DWORD offset)
|
|||
pos, &bAbsolute);
|
||||
}
|
||||
|
||||
if (lp != NULL)
|
||||
HeapFree(GetProcessHeap(), 0, lp);
|
||||
HeapFree(GetProcessHeap(), 0, lp);
|
||||
|
||||
/* checking ... */
|
||||
for (n = 0; n < This->fInfo.dwStreams; n++) {
|
||||
|
|
|
@ -340,8 +340,7 @@ static BOOL AVIFILE_FormatsEqual(PAVISTREAM avi1, PAVISTREAM avi2)
|
|||
}
|
||||
}
|
||||
|
||||
if (fmt2 != NULL)
|
||||
HeapFree(GetProcessHeap(), 0, fmt2);
|
||||
HeapFree(GetProcessHeap(), 0, fmt2);
|
||||
HeapFree(GetProcessHeap(), 0, fmt1);
|
||||
|
||||
return status;
|
||||
|
|
|
@ -3821,7 +3821,7 @@ static void d3ddevice_lock_update(IDirectDrawSurfaceImpl* This, LPCRECT pRect, D
|
|||
buffer_color, buffer_format, dst);
|
||||
|
||||
if (current_width > buffer_width) {
|
||||
if (buffer != NULL) HeapFree(GetProcessHeap(), 0, buffer);
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
buffer_width = current_width;
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, buffer_width);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ static void Main_DirectDrawSurface_Destroy(IDirectDrawSurfaceImpl* This)
|
|||
}
|
||||
This->final_release(This);
|
||||
if (This->private != This+1) HeapFree(GetProcessHeap(), 0, This->private);
|
||||
if (This->tex_private) HeapFree(GetProcessHeap(), 0, This->tex_private);
|
||||
HeapFree(GetProcessHeap(), 0, This->tex_private);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
|
|
|
@ -755,8 +755,7 @@ DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
|
|||
}
|
||||
else
|
||||
ret = ERROR_OUTOFMEMORY;
|
||||
if (ipAddrTable)
|
||||
HeapFree(GetProcessHeap(), 0, ipAddrTable);
|
||||
HeapFree(GetProcessHeap(), 0, ipAddrTable);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -635,7 +635,7 @@ static void MSACM_ReorderDriversByPriority(void)
|
|||
|
||||
errCleanUp:
|
||||
if (hPriorityKey != NULL) RegCloseKey(hPriorityKey);
|
||||
if (driverList != NULL) HeapFree(MSACM_hHeap, 0, driverList);
|
||||
HeapFree(MSACM_hHeap, 0, driverList);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -211,8 +211,7 @@ static HRESULT WINAPI Hlink_SetMonikerReference(IHlink *iface, DWORD grfHLSETF,
|
|||
|
||||
if(This->mon)
|
||||
IMoniker_Release(This->mon);
|
||||
if(This->location)
|
||||
HeapFree(GetProcessHeap(), 0, This->location);
|
||||
HeapFree(GetProcessHeap(), 0, This->location);
|
||||
|
||||
if(pimkTarget)
|
||||
IMoniker_AddRef(pimkTarget);
|
||||
|
|
|
@ -1437,14 +1437,10 @@ void VFWAPI ICSeqCompressFrameEnd(PCOMPVARS pc)
|
|||
TRACE("(%p)\n", pc);
|
||||
ret = ICSendMessage(pc->hic, ICM_COMPRESS_END, 0, 0);
|
||||
TRACE(" -- %lx", ret);
|
||||
if (pc->lpbiIn)
|
||||
HeapFree(GetProcessHeap(), 0, pc->lpbiIn);
|
||||
if (pc->lpBitsPrev)
|
||||
HeapFree(GetProcessHeap(), 0, pc->lpBitsPrev);
|
||||
if (pc->lpBitsOut)
|
||||
HeapFree(GetProcessHeap(), 0, pc->lpBitsOut);
|
||||
if (pc->lpState)
|
||||
HeapFree(GetProcessHeap(), 0, pc->lpState);
|
||||
HeapFree(GetProcessHeap(), 0, pc->lpbiIn);
|
||||
HeapFree(GetProcessHeap(), 0, pc->lpBitsPrev);
|
||||
HeapFree(GetProcessHeap(), 0, pc->lpBitsOut);
|
||||
HeapFree(GetProcessHeap(), 0, pc->lpState);
|
||||
pc->lpbiIn = pc->lpBitsPrev = pc->lpBitsOut = pc->lpState = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1336,9 +1336,7 @@ static void process_detach(void)
|
|||
|
||||
/* Do not leak memory... */
|
||||
wgl_ext_finalize_extensions();
|
||||
if (NULL != internal_gl_extensions) {
|
||||
HeapFree(GetProcessHeap(), 0, internal_gl_extensions);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, internal_gl_extensions);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -1078,7 +1078,7 @@ HPBUFFERARB WINAPI wglCreatePbufferARB(HDC hdc, int iPixelFormat, int iWidth, in
|
|||
|
||||
create_failed:
|
||||
if (NULL != cfgs) XFree(cfgs);
|
||||
if (NULL != object) HeapFree(GetProcessHeap(), 0, object);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
TRACE("->(FAILED)\n");
|
||||
return (HPBUFFERARB) NULL;
|
||||
}
|
||||
|
|
|
@ -782,8 +782,7 @@ ME_StreamOutText(ME_TextEditor *editor, ME_OutStream *pStream, int nStart, int n
|
|||
nSize = WideCharToMultiByte(nCodePage, 0, item->member.run.strText->szData + nStart,
|
||||
nLen, NULL, 0, NULL, NULL);
|
||||
if (nSize > nBufLen) {
|
||||
if (buffer)
|
||||
FREE_OBJ(buffer);
|
||||
FREE_OBJ(buffer);
|
||||
buffer = ALLOC_N_OBJ(char, nSize);
|
||||
nBufLen = nSize;
|
||||
}
|
||||
|
@ -800,8 +799,7 @@ ME_StreamOutText(ME_TextEditor *editor, ME_OutStream *pStream, int nStart, int n
|
|||
item = ME_FindItemFwd(item, diRun);
|
||||
}
|
||||
|
||||
if (buffer)
|
||||
FREE_OBJ(buffer);
|
||||
FREE_OBJ(buffer);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
@ -666,8 +666,7 @@ static void SECUR32_freeProviders(void)
|
|||
{
|
||||
LIST_FOR_EACH_ENTRY(provider, &providerTable->table, SecureProvider, entry)
|
||||
{
|
||||
if (provider->moduleName)
|
||||
SECUR32_FREE(provider->moduleName);
|
||||
SECUR32_FREE(provider->moduleName);
|
||||
if (provider->lib)
|
||||
FreeLibrary(provider->lib);
|
||||
}
|
||||
|
@ -689,7 +688,7 @@ static void SECUR32_freeProviders(void)
|
|||
*/
|
||||
SECURITY_STATUS WINAPI FreeContextBuffer(PVOID pv)
|
||||
{
|
||||
if (pv) SECUR32_FREE(pv);
|
||||
SECUR32_FREE(pv);
|
||||
|
||||
return SEC_E_OK;
|
||||
}
|
||||
|
|
|
@ -162,12 +162,9 @@ SECURITY_STATUS setupClient(PCredHandle cred, const char *user,
|
|||
|
||||
if( identity != NULL)
|
||||
{
|
||||
if(identity->Domain != 0)
|
||||
HeapFree(GetProcessHeap(), 0, identity->Domain);
|
||||
if(identity->User != 0)
|
||||
HeapFree(GetProcessHeap(), 0, identity->User);
|
||||
if(identity->Password != 0)
|
||||
HeapFree(GetProcessHeap(), 0, identity->Password);
|
||||
HeapFree(GetProcessHeap(), 0, identity->Domain);
|
||||
HeapFree(GetProcessHeap(), 0, identity->User);
|
||||
HeapFree(GetProcessHeap(), 0, identity->Password);
|
||||
HeapFree(GetProcessHeap(), 0, identity);
|
||||
}
|
||||
|
||||
|
|
|
@ -77,10 +77,8 @@ SECURITY_STATUS SEC_ENTRY thunk_AcquireCredentialsHandleW(
|
|||
ret = AcquireCredentialsHandleA(principal, package, fCredentialsUse,
|
||||
pvLogonID, pAuthData, pGetKeyFn, pvGetKeyArgument, phCredential,
|
||||
ptsExpiry);
|
||||
if (principal)
|
||||
SECUR32_FREE(principal);
|
||||
if (package)
|
||||
SECUR32_FREE(package);
|
||||
SECUR32_FREE(principal);
|
||||
SECUR32_FREE(package);
|
||||
}
|
||||
else
|
||||
ret = SEC_E_SECPKG_NOT_FOUND;
|
||||
|
@ -262,8 +260,7 @@ SECURITY_STATUS SEC_ENTRY thunk_InitializeSecurityContextW(
|
|||
phCredential, phContext, target, fContextReq, Reserved1,
|
||||
TargetDataRep, pInput, Reserved2, phNewContext, pOutput,
|
||||
pfContextAttr, ptsExpiry);
|
||||
if (target)
|
||||
SECUR32_FREE(target);
|
||||
SECUR32_FREE(target);
|
||||
}
|
||||
else
|
||||
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
||||
|
@ -898,7 +895,6 @@ SECURITY_STATUS SEC_ENTRY thunk_ImportSecurityContextW(
|
|||
TRACE("%s %p %p %p\n", debugstr_w(pszPackage), pPackedContext, Token,
|
||||
phContext);
|
||||
ret = ImportSecurityContextA(package, pPackedContext, Token, phContext);
|
||||
if (package)
|
||||
SECUR32_FREE(package);
|
||||
SECUR32_FREE(package);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -737,10 +737,8 @@ static HRESULT URLMonikerImpl_BindToStorage_hack(LPCWSTR URLName,
|
|||
Binding_CloseCacheDownload(bind);
|
||||
Binding_FinishedDownload(bind, hres);
|
||||
|
||||
if (user)
|
||||
HeapFree(GetProcessHeap(), 0, user);
|
||||
if (pass)
|
||||
HeapFree(GetProcessHeap(), 0, pass);
|
||||
HeapFree(GetProcessHeap(), 0, user);
|
||||
HeapFree(GetProcessHeap(), 0, pass);
|
||||
HeapFree(GetProcessHeap(), 0, path);
|
||||
HeapFree(GetProcessHeap(), 0, host);
|
||||
HeapFree(GetProcessHeap(), 0, urlcopy);
|
||||
|
|
|
@ -60,9 +60,7 @@ ULONG WINAPI IWineD3DQueryImpl_Release(IWineD3DQuery *iface) {
|
|||
TRACE("(%p) : Releasing from %ld\n", This, This->ref);
|
||||
ref = InterlockedDecrement(&This->ref);
|
||||
if (ref == 0) {
|
||||
if(This->extendedData != NULL){
|
||||
HeapFree(GetProcessHeap(), 0, This->extendedData);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, This->extendedData);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
return ref;
|
||||
|
|
|
@ -1533,8 +1533,7 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
|
|||
debugstr_wn(lpUC->lpszUrlPath,lpUC->dwUrlPathLength),
|
||||
debugstr_wn(lpUC->lpszExtraInfo,lpUC->dwExtraInfoLength));
|
||||
|
||||
if (lpszUrl_decode)
|
||||
HeapFree(GetProcessHeap(), 0, lpszUrl_decode );
|
||||
HeapFree(GetProcessHeap(), 0, lpszUrl_decode );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -2280,7 +2280,6 @@ BOOL WINAPI CommitUrlCacheEntryA(
|
|||
{
|
||||
dwError = GetLastError();
|
||||
}
|
||||
if (original_url)
|
||||
HeapFree(GetProcessHeap(), 0, original_url);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1041,12 +1041,10 @@ static int ALSA_AddCommonDevice(snd_ctl_t *ctl, snd_pcm_t *pcm, const char *pcmn
|
|||
*/
|
||||
static void ALSA_FreeDevice(WINE_WAVEDEV *ww)
|
||||
{
|
||||
if (ww->pcmname)
|
||||
HeapFree(GetProcessHeap(), 0, ww->pcmname);
|
||||
HeapFree(GetProcessHeap(), 0, ww->pcmname);
|
||||
ww->pcmname = NULL;
|
||||
|
||||
if (ww->ctlname)
|
||||
HeapFree(GetProcessHeap(), 0, ww->ctlname);
|
||||
HeapFree(GetProcessHeap(), 0, ww->ctlname);
|
||||
ww->ctlname = NULL;
|
||||
}
|
||||
|
||||
|
@ -1627,11 +1625,8 @@ LONG ALSA_WaveInit(void)
|
|||
ALSA_AddUserSpecifiedDevice(ctl_name, pcm_name);
|
||||
}
|
||||
|
||||
if (ctl_name)
|
||||
HeapFree(GetProcessHeap(), 0, ctl_name);
|
||||
|
||||
if (pcm_name)
|
||||
HeapFree(GetProcessHeap(), 0, pcm_name);
|
||||
HeapFree(GetProcessHeap(), 0, ctl_name);
|
||||
HeapFree(GetProcessHeap(), 0, pcm_name);
|
||||
}
|
||||
|
||||
if (key)
|
||||
|
|
|
@ -389,12 +389,8 @@ void ESD_CloseWaveOutDevice(WINE_WAVEOUT* wwo)
|
|||
wwo->esd_fd = -1;
|
||||
|
||||
/* free up the buffer we use for volume and reset the size */
|
||||
if(wwo->sound_buffer)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, wwo->sound_buffer);
|
||||
wwo->sound_buffer = NULL;
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, wwo->sound_buffer);
|
||||
wwo->sound_buffer = NULL;
|
||||
wwo->buffer_size = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -344,8 +344,7 @@ static void FreeEntry(int entry)
|
|||
formatEntry->realized = NULL;
|
||||
if(formatEntry->bitmaps) {
|
||||
for(i = 0; i < formatEntry->nrealized; i++)
|
||||
if(formatEntry->bitmaps[i])
|
||||
HeapFree(GetProcessHeap(), 0, formatEntry->bitmaps[i]);
|
||||
HeapFree(GetProcessHeap(), 0, formatEntry->bitmaps[i]);
|
||||
HeapFree(GetProcessHeap(), 0, formatEntry->bitmaps);
|
||||
formatEntry->bitmaps = NULL;
|
||||
HeapFree(GetProcessHeap(), 0, formatEntry->gis);
|
||||
|
|
|
@ -628,8 +628,7 @@ done:
|
|||
SendMessage(hwndTV, WM_SETREDRAW, TRUE, 0);
|
||||
SetCursor(hcursorOld);
|
||||
expanding = FALSE;
|
||||
if (keyPath)
|
||||
HeapFree(GetProcessHeap(), 0, keyPath);
|
||||
HeapFree(GetProcessHeap(), 0, keyPath);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -326,8 +326,7 @@ static BOOL pendingRename(void)
|
|||
res=TRUE;
|
||||
|
||||
end:
|
||||
if( buffer!=NULL )
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
|
||||
if( hSession!=NULL )
|
||||
RegCloseKey( hSession );
|
||||
|
|
|
@ -480,11 +480,8 @@ static void findAudioDrivers(void)
|
|||
HCURSOR old_cursor;
|
||||
|
||||
/* delete an existing list */
|
||||
if (loadedAudioDrv)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, loadedAudioDrv);
|
||||
loadedAudioDrv = 0;
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, loadedAudioDrv);
|
||||
loadedAudioDrv = 0;
|
||||
|
||||
/* change to the wait cursor because this can take a while if there is a
|
||||
* misbehaving driver that takes a long time to open
|
||||
|
|
Loading…
Add table
Reference in a new issue