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);
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;

View File

@ -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;

View File

@ -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) {

View File

@ -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;
}

View File

@ -811,10 +811,10 @@ done:
list_remove(&current_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);
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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);