Do not check for non NULL pointer before HeapFree'ing it. It's

redundant.
This commit is contained in:
Michael Stefaniuc 2005-01-03 14:56:42 +00:00 committed by Alexandre Julliard
parent 89f5283432
commit 15a308a9d7
12 changed files with 21 additions and 39 deletions

View File

@ -387,7 +387,7 @@ BOOL WINAPI ReportEventA ( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD d
wNumStrings, dwDataSize, wideStrArray, lpRawData); wNumStrings, dwDataSize, wideStrArray, lpRawData);
for (i = 0; i < wNumStrings; i++) 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); HeapFree(GetProcessHeap(), 0, wideStrArray);
return ret; return ret;

View File

@ -439,12 +439,9 @@ BOOL coff_process_info(const struct msc_debug_info* msc_dbg)
} }
for (j = 0; j < coff_files.nfiles; j++) 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); HeapFree(GetProcessHeap(), 0, coff_files.files);
msc_dbg->module->module.SymType = SymCoff; msc_dbg->module->module.SymType = SymCoff;
ret = TRUE; ret = TRUE;

View File

@ -93,18 +93,14 @@ static DWORD WINAPI ProcessMsgThread(LPVOID lpParam) {
for (it = This->imm_head; NULL != it; ) { for (it = This->imm_head; NULL != it; ) {
it_next = it->next; it_next = it->next;
cur = ProceedMsg(This, it); cur = ProceedMsg(This, it);
if (NULL != cur) {
HeapFree(GetProcessHeap(), 0, cur); HeapFree(GetProcessHeap(), 0, cur);
}
it = it_next; it = it_next;
} }
for (it = This->head; NULL != it && it->rtItemTime < rtCurTime + dwDec; ) { for (it = This->head; NULL != it && it->rtItemTime < rtCurTime + dwDec; ) {
it_next = it->next; it_next = it->next;
cur = ProceedMsg(This, it); cur = ProceedMsg(This, it);
if (NULL != cur) {
HeapFree(GetProcessHeap(), 0, cur); HeapFree(GetProcessHeap(), 0, cur);
}
it = it_next; it = it_next;
} }
if (NULL != it) { if (NULL != it) {

View File

@ -263,7 +263,7 @@ static void PROFILE_Free( PROFILESECTION *section )
for (key = section->key; key; key = next_key) for (key = section->key; key; key = next_key)
{ {
next_key = key->next; next_key = key->next;
if (key->value) HeapFree( GetProcessHeap(), 0, key->value ); HeapFree( GetProcessHeap(), 0, key->value );
HeapFree( GetProcessHeap(), 0, key ); HeapFree( GetProcessHeap(), 0, key );
} }
next_section = section->next; next_section = section->next;
@ -580,7 +580,7 @@ void PROFILE_DeleteAllKeys( LPCWSTR section_name)
{ {
PROFILEKEY *to_del = *key; PROFILEKEY *to_del = *key;
*key = to_del->next; *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 ); HeapFree( GetProcessHeap(), 0, to_del );
CurProfile->changed =TRUE; CurProfile->changed =TRUE;
} }

View File

@ -811,10 +811,10 @@ done:
list_remove(&current_resource->entry); list_remove(&current_resource->entry);
if(HIWORD(current_resource->lpType)) HeapFree(GetProcessHeap(), 0, current_resource->lpType); if(HIWORD(current_resource->lpType)) HeapFree(GetProcessHeap(), 0, current_resource->lpType);
if(HIWORD(current_resource->lpName)) HeapFree(GetProcessHeap(), 0, current_resource->lpName); 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); HeapFree(GetProcessHeap(), 0, current_resource);
} }
if(current_updates->pFileName) HeapFree(GetProcessHeap(), 0, current_updates->pFileName); HeapFree(GetProcessHeap(), 0, current_updates->pFileName);
GlobalUnlock(hUpdate); GlobalUnlock(hUpdate);
GlobalFree(hUpdate); GlobalFree(hUpdate);
} }

View File

@ -301,7 +301,6 @@ HRESULT WINAPI BindCtxImpl_ReleaseBoundObjects(IBindCtx* iface)
{ {
if(This->bindCtxTable[i].pObj) if(This->bindCtxTable[i].pObj)
IUnknown_Release(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);
} }

View File

@ -3032,11 +3032,9 @@ static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface)
int i; int i;
for (i = 0; i < MSFT_SEG_MAX; i++) { for (i = 0; i < MSFT_SEG_MAX; i++) {
if (This->typelib_segment_data[i]) {
HeapFree(GetProcessHeap(), 0, This->typelib_segment_data[i]); HeapFree(GetProcessHeap(), 0, This->typelib_segment_data[i]);
This->typelib_segment_data[i] = NULL; This->typelib_segment_data[i] = NULL;
} }
}
HeapFree(GetProcessHeap(), 0, This->filename); HeapFree(GetProcessHeap(), 0, This->filename);
This->filename = NULL; This->filename = NULL;
@ -3044,7 +3042,7 @@ static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface)
while (This->typeinfos) { while (This->typeinfos) {
ICreateTypeInfo2Impl *typeinfo = This->typeinfos; ICreateTypeInfo2Impl *typeinfo = This->typeinfos;
This->typeinfos = typeinfo->next_typeinfo; This->typeinfos = typeinfo->next_typeinfo;
if (typeinfo->typedata) HeapFree(GetProcessHeap(), 0, typeinfo->typedata); HeapFree(GetProcessHeap(), 0, typeinfo->typedata);
HeapFree(GetProcessHeap(), 0, typeinfo); HeapFree(GetProcessHeap(), 0, typeinfo);
} }

View File

@ -376,7 +376,7 @@ void T42_free(TYPE42 *t42)
{ {
OTTable *table; OTTable *table;
for(table = t42->tables; table->MS_tag; 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->glyph_sent);
HeapFree(GetProcessHeap(), 0, t42->glyf_blocks); HeapFree(GetProcessHeap(), 0, t42->glyf_blocks);
HeapFree(GetProcessHeap(), 0, t42); HeapFree(GetProcessHeap(), 0, t42);

View File

@ -2630,7 +2630,6 @@ static void FTP_CloseFindNextHandle(LPWININETHANDLEHEADER hdr)
for (i = 0; i < lpwfn->size; i++) 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);
} }

View File

@ -2485,17 +2485,13 @@ static void HTTP_CloseHTTPRequestHandle(LPWININETHANDLEHEADER hdr)
for (i = 0; i <= HTTP_QUERY_MAX; i++) for (i = 0; i <= HTTP_QUERY_MAX; i++)
{ {
if (lpwhr->StdHeaders[i].lpszField)
HeapFree(GetProcessHeap(), 0, 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].lpszValue);
} }
for (i = 0; i < lpwhr->nCustHeaders; i++) for (i = 0; i < lpwhr->nCustHeaders; i++)
{ {
if (lpwhr->pCustHeaders[i].lpszField)
HeapFree(GetProcessHeap(), 0, 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].lpszValue);
} }

View File

@ -1492,9 +1492,7 @@ static DWORD MIX_Exit(void)
TRACE("()\n"); TRACE("()\n");
for (i = 0; i < MIX_NumMixers; i++) { for (i = 0; i < MIX_NumMixers; i++) {
if (MIX_Mixers[i].name)
HeapFree(GetProcessHeap(),0,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].dev_name);
} }

View File

@ -305,7 +305,6 @@ static void FreeEntry(int entry)
glyphsetCache[entry].realized = NULL; glyphsetCache[entry].realized = NULL;
if(glyphsetCache[entry].bitmaps) { if(glyphsetCache[entry].bitmaps) {
for(i = 0; i < glyphsetCache[entry].nrealized; i++) 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); HeapFree(GetProcessHeap(), 0, glyphsetCache[entry].bitmaps);
glyphsetCache[entry].bitmaps = NULL; glyphsetCache[entry].bitmaps = NULL;