From 15a308a9d7c7774a3b452507b4576c9bc6b14955 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Mon, 3 Jan 2005 14:56:42 +0000 Subject: [PATCH] Do not check for non NULL pointer before HeapFree'ing it. It's redundant. --- dlls/advapi32/eventlog.c | 2 +- dlls/dbghelp/coff.c | 5 +---- dlls/dmime/performance.c | 8 ++------ dlls/kernel/profile.c | 4 ++-- dlls/kernel/resource.c | 4 ++-- dlls/ole32/bindctx.c | 3 +-- dlls/oleaut32/typelib2.c | 8 +++----- dlls/wineps/type42.c | 2 +- dlls/wininet/ftp.c | 3 +-- dlls/wininet/http.c | 12 ++++-------- dlls/winmm/wineoss/mixer.c | 6 ++---- dlls/x11drv/xrender.c | 3 +-- 12 files changed, 21 insertions(+), 39 deletions(-) diff --git a/dlls/advapi32/eventlog.c b/dlls/advapi32/eventlog.c index ee7f9652fbd..eedc86f2159 100644 --- a/dlls/advapi32/eventlog.c +++ b/dlls/advapi32/eventlog.c @@ -387,7 +387,7 @@ BOOL WINAPI ReportEventA ( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD d wNumStrings, dwDataSize, wideStrArray, lpRawData); for (i = 0; i < wNumStrings; i++) { - if (wideStrArray[i]) HeapFree( GetProcessHeap(), 0, (LPSTR)wideStrArray[i] ); + HeapFree( GetProcessHeap(), 0, (LPSTR)wideStrArray[i] ); } HeapFree(GetProcessHeap(), 0, wideStrArray); return ret; diff --git a/dlls/dbghelp/coff.c b/dlls/dbghelp/coff.c index eb672df89ad..4b33f658b73 100644 --- a/dlls/dbghelp/coff.c +++ b/dlls/dbghelp/coff.c @@ -440,10 +440,7 @@ BOOL coff_process_info(const struct msc_debug_info* msc_dbg) for (j = 0; j < coff_files.nfiles; j++) { - if (coff_files.files[j].entries != NULL) - { - HeapFree(GetProcessHeap(), 0, coff_files.files[j].entries); - } + HeapFree(GetProcessHeap(), 0, coff_files.files[j].entries); } HeapFree(GetProcessHeap(), 0, coff_files.files); msc_dbg->module->module.SymType = SymCoff; diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c index 2252718b97f..1fa5e565b9e 100644 --- a/dlls/dmime/performance.c +++ b/dlls/dmime/performance.c @@ -93,18 +93,14 @@ static DWORD WINAPI ProcessMsgThread(LPVOID lpParam) { for (it = This->imm_head; NULL != it; ) { it_next = it->next; cur = ProceedMsg(This, it); - if (NULL != cur) { - HeapFree(GetProcessHeap(), 0, cur); - } + HeapFree(GetProcessHeap(), 0, cur); it = it_next; } for (it = This->head; NULL != it && it->rtItemTime < rtCurTime + dwDec; ) { it_next = it->next; cur = ProceedMsg(This, it); - if (NULL != cur) { - HeapFree(GetProcessHeap(), 0, cur); - } + HeapFree(GetProcessHeap(), 0, cur); it = it_next; } if (NULL != it) { diff --git a/dlls/kernel/profile.c b/dlls/kernel/profile.c index 1832afb9cdb..a4dad07736b 100644 --- a/dlls/kernel/profile.c +++ b/dlls/kernel/profile.c @@ -263,7 +263,7 @@ static void PROFILE_Free( PROFILESECTION *section ) for (key = section->key; key; key = next_key) { next_key = key->next; - if (key->value) HeapFree( GetProcessHeap(), 0, key->value ); + HeapFree( GetProcessHeap(), 0, key->value ); HeapFree( GetProcessHeap(), 0, key ); } next_section = section->next; @@ -580,7 +580,7 @@ void PROFILE_DeleteAllKeys( LPCWSTR section_name) { PROFILEKEY *to_del = *key; *key = to_del->next; - if (to_del->value) HeapFree( GetProcessHeap(), 0, to_del->value); + HeapFree( GetProcessHeap(), 0, to_del->value); HeapFree( GetProcessHeap(), 0, to_del ); CurProfile->changed =TRUE; } diff --git a/dlls/kernel/resource.c b/dlls/kernel/resource.c index 58dcb9d7a6a..a47861f2a1d 100644 --- a/dlls/kernel/resource.c +++ b/dlls/kernel/resource.c @@ -811,10 +811,10 @@ done: list_remove(¤t_resource->entry); if(HIWORD(current_resource->lpType)) HeapFree(GetProcessHeap(), 0, current_resource->lpType); if(HIWORD(current_resource->lpName)) HeapFree(GetProcessHeap(), 0, current_resource->lpName); - if(current_resource->lpData) HeapFree(GetProcessHeap(), 0, current_resource->lpData); + HeapFree(GetProcessHeap(), 0, current_resource->lpData); HeapFree(GetProcessHeap(), 0, current_resource); } - if(current_updates->pFileName) HeapFree(GetProcessHeap(), 0, current_updates->pFileName); + HeapFree(GetProcessHeap(), 0, current_updates->pFileName); GlobalUnlock(hUpdate); GlobalFree(hUpdate); } diff --git a/dlls/ole32/bindctx.c b/dlls/ole32/bindctx.c index e13d2a9a942..104c016f9be 100644 --- a/dlls/ole32/bindctx.c +++ b/dlls/ole32/bindctx.c @@ -301,8 +301,7 @@ HRESULT WINAPI BindCtxImpl_ReleaseBoundObjects(IBindCtx* iface) { if(This->bindCtxTable[i].pObj) IUnknown_Release(This->bindCtxTable[i].pObj); - if(This->bindCtxTable[i].pkeyObj) - HeapFree(GetProcessHeap(),0,This->bindCtxTable[i].pkeyObj); + HeapFree(GetProcessHeap(),0,This->bindCtxTable[i].pkeyObj); } This->bindCtxTableLastIndex = 0; diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c index 42540f4674b..f9c88d83cae 100644 --- a/dlls/oleaut32/typelib2.c +++ b/dlls/oleaut32/typelib2.c @@ -3032,10 +3032,8 @@ static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface) int i; for (i = 0; i < MSFT_SEG_MAX; i++) { - if (This->typelib_segment_data[i]) { - HeapFree(GetProcessHeap(), 0, This->typelib_segment_data[i]); - This->typelib_segment_data[i] = NULL; - } + HeapFree(GetProcessHeap(), 0, This->typelib_segment_data[i]); + This->typelib_segment_data[i] = NULL; } HeapFree(GetProcessHeap(), 0, This->filename); @@ -3044,7 +3042,7 @@ static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface) while (This->typeinfos) { ICreateTypeInfo2Impl *typeinfo = This->typeinfos; This->typeinfos = typeinfo->next_typeinfo; - if (typeinfo->typedata) HeapFree(GetProcessHeap(), 0, typeinfo->typedata); + HeapFree(GetProcessHeap(), 0, typeinfo->typedata); HeapFree(GetProcessHeap(), 0, typeinfo); } diff --git a/dlls/wineps/type42.c b/dlls/wineps/type42.c index 60a9b418be6..a92b3e6f4d9 100644 --- a/dlls/wineps/type42.c +++ b/dlls/wineps/type42.c @@ -376,7 +376,7 @@ void T42_free(TYPE42 *t42) { OTTable *table; for(table = t42->tables; table->MS_tag; table++) - if(table->data) HeapFree(GetProcessHeap(), 0, table->data); + HeapFree(GetProcessHeap(), 0, table->data); HeapFree(GetProcessHeap(), 0, t42->glyph_sent); HeapFree(GetProcessHeap(), 0, t42->glyf_blocks); HeapFree(GetProcessHeap(), 0, t42); diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c index 1fbb5d5bfbe..8161f01be36 100644 --- a/dlls/wininet/ftp.c +++ b/dlls/wininet/ftp.c @@ -2630,8 +2630,7 @@ static void FTP_CloseFindNextHandle(LPWININETHANDLEHEADER hdr) for (i = 0; i < lpwfn->size; i++) { - if (NULL != lpwfn->lpafp[i].lpszName) - HeapFree(GetProcessHeap(), 0, lpwfn->lpafp[i].lpszName); + HeapFree(GetProcessHeap(), 0, lpwfn->lpafp[i].lpszName); } HeapFree(GetProcessHeap(), 0, lpwfn->lpafp); diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 915abf9ca8d..cb1b38f52b2 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -2485,18 +2485,14 @@ static void HTTP_CloseHTTPRequestHandle(LPWININETHANDLEHEADER hdr) for (i = 0; i <= HTTP_QUERY_MAX; i++) { - if (lpwhr->StdHeaders[i].lpszField) - HeapFree(GetProcessHeap(), 0, lpwhr->StdHeaders[i].lpszField); - if (lpwhr->StdHeaders[i].lpszValue) - HeapFree(GetProcessHeap(), 0, lpwhr->StdHeaders[i].lpszValue); + HeapFree(GetProcessHeap(), 0, lpwhr->StdHeaders[i].lpszField); + HeapFree(GetProcessHeap(), 0, lpwhr->StdHeaders[i].lpszValue); } for (i = 0; i < lpwhr->nCustHeaders; i++) { - if (lpwhr->pCustHeaders[i].lpszField) - HeapFree(GetProcessHeap(), 0, lpwhr->pCustHeaders[i].lpszField); - if (lpwhr->pCustHeaders[i].lpszValue) - HeapFree(GetProcessHeap(), 0, lpwhr->pCustHeaders[i].lpszValue); + HeapFree(GetProcessHeap(), 0, lpwhr->pCustHeaders[i].lpszField); + HeapFree(GetProcessHeap(), 0, lpwhr->pCustHeaders[i].lpszValue); } HeapFree(GetProcessHeap(), 0, lpwhr->pCustHeaders); diff --git a/dlls/winmm/wineoss/mixer.c b/dlls/winmm/wineoss/mixer.c index 13d88db27f4..92dbe376bdf 100644 --- a/dlls/winmm/wineoss/mixer.c +++ b/dlls/winmm/wineoss/mixer.c @@ -1492,10 +1492,8 @@ static DWORD MIX_Exit(void) TRACE("()\n"); for (i = 0; i < MIX_NumMixers; i++) { - if (MIX_Mixers[i].name) - HeapFree(GetProcessHeap(),0,MIX_Mixers[i].name); - if (MIX_Mixers[i].dev_name) - HeapFree(GetProcessHeap(),0,MIX_Mixers[i].dev_name); + HeapFree(GetProcessHeap(),0,MIX_Mixers[i].name); + HeapFree(GetProcessHeap(),0,MIX_Mixers[i].dev_name); } return MMSYSERR_NOERROR; diff --git a/dlls/x11drv/xrender.c b/dlls/x11drv/xrender.c index 07f71242729..974b30f56b6 100644 --- a/dlls/x11drv/xrender.c +++ b/dlls/x11drv/xrender.c @@ -305,8 +305,7 @@ static void FreeEntry(int entry) glyphsetCache[entry].realized = NULL; if(glyphsetCache[entry].bitmaps) { for(i = 0; i < glyphsetCache[entry].nrealized; i++) - if(glyphsetCache[entry].bitmaps[i]) - HeapFree(GetProcessHeap(), 0, glyphsetCache[entry].bitmaps[i]); + HeapFree(GetProcessHeap(), 0, glyphsetCache[entry].bitmaps[i]); HeapFree(GetProcessHeap(), 0, glyphsetCache[entry].bitmaps); glyphsetCache[entry].bitmaps = NULL; HeapFree(GetProcessHeap(), 0, glyphsetCache[entry].gis);