Commit fee72b60 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

Yet another round of redundant NULL checks before HeapFree.

parent 24beabfd
...@@ -175,14 +175,10 @@ static ULONG WINAPI ACMStream_fnRelease(IAVIStream* iface) ...@@ -175,14 +175,10 @@ static ULONG WINAPI ACMStream_fnRelease(IAVIStream* iface)
acmStreamClose(This->has, 0); acmStreamClose(This->has, 0);
This->has = NULL; This->has = NULL;
} }
if (This->acmStreamHdr.pbSrc != NULL) { HeapFree(GetProcessHeap(), 0, This->acmStreamHdr.pbSrc);
HeapFree(GetProcessHeap(), 0, This->acmStreamHdr.pbSrc); This->acmStreamHdr.pbSrc = NULL;
This->acmStreamHdr.pbSrc = NULL; HeapFree(GetProcessHeap(), 0, This->acmStreamHdr.pbDst);
} This->acmStreamHdr.pbDst = NULL;
if (This->acmStreamHdr.pbDst != NULL) {
HeapFree(GetProcessHeap(), 0, This->acmStreamHdr.pbDst);
This->acmStreamHdr.pbDst = NULL;
}
if (This->lpInFormat != NULL) { if (This->lpInFormat != NULL) {
HeapFree(GetProcessHeap(), 0, This->lpInFormat); HeapFree(GetProcessHeap(), 0, This->lpInFormat);
This->lpInFormat = NULL; This->lpInFormat = NULL;
......
...@@ -326,10 +326,9 @@ static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface) ...@@ -326,10 +326,9 @@ static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface)
This->fileextra.cb = 0; This->fileextra.cb = 0;
} }
if (This->szFileName != NULL) { HeapFree(GetProcessHeap(), 0, This->szFileName);
HeapFree(GetProcessHeap(), 0, This->szFileName); This->szFileName = NULL;
This->szFileName = NULL;
}
if (This->hmmio != NULL) { if (This->hmmio != NULL) {
mmioClose(This->hmmio, 0); mmioClose(This->hmmio, 0);
This->hmmio = NULL; This->hmmio = NULL;
...@@ -1565,10 +1564,8 @@ static void AVIFILE_DestructAVIStream(IAVIStreamImpl *This) ...@@ -1565,10 +1564,8 @@ static void AVIFILE_DestructAVIStream(IAVIStreamImpl *This)
This->idxFrames = NULL; This->idxFrames = NULL;
This->nIdxFrames = 0; This->nIdxFrames = 0;
} }
if (This->idxFmtChanges != NULL) { HeapFree(GetProcessHeap(), 0, This->idxFmtChanges);
HeapFree(GetProcessHeap(), 0, This->idxFmtChanges); This->idxFmtChanges = NULL;
This->idxFmtChanges = NULL;
}
if (This->lpBuffer != NULL) { if (This->lpBuffer != NULL) {
HeapFree(GetProcessHeap(), 0, This->lpBuffer); HeapFree(GetProcessHeap(), 0, This->lpBuffer);
This->lpBuffer = NULL; This->lpBuffer = NULL;
......
...@@ -97,14 +97,12 @@ typedef struct _IGetFrameImpl { ...@@ -97,14 +97,12 @@ typedef struct _IGetFrameImpl {
static void AVIFILE_CloseCompressor(IGetFrameImpl *This) static void AVIFILE_CloseCompressor(IGetFrameImpl *This)
{ {
if (This->lpOutFormat != NULL && This->lpInFormat != This->lpOutFormat) { if (This->lpInFormat != This->lpOutFormat) {
HeapFree(GetProcessHeap(), 0, This->lpOutFormat); HeapFree(GetProcessHeap(), 0, This->lpOutFormat);
This->lpOutFormat = NULL; This->lpOutFormat = NULL;
} }
if (This->lpInFormat != NULL) { HeapFree(GetProcessHeap(), 0, This->lpInFormat);
HeapFree(GetProcessHeap(), 0, This->lpInFormat); This->lpInFormat = NULL;
This->lpInFormat = NULL;
}
if (This->hic != NULL) { if (This->hic != NULL) {
if (This->bResize) if (This->bResize)
ICDecompressExEnd(This->hic); ICDecompressExEnd(This->hic);
......
...@@ -297,10 +297,8 @@ static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface) ...@@ -297,10 +297,8 @@ static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface)
This->extra.lp = NULL; This->extra.lp = NULL;
This->extra.cb = 0; This->extra.cb = 0;
} }
if (This->szFileName != NULL) { HeapFree(GetProcessHeap(), 0, This->szFileName);
HeapFree(GetProcessHeap(), 0, This->szFileName); This->szFileName = NULL;
This->szFileName = NULL;
}
if (This->hmmio != NULL) { if (This->hmmio != NULL) {
mmioClose(This->hmmio, 0); mmioClose(This->hmmio, 0);
This->hmmio = NULL; This->hmmio = NULL;
......
...@@ -764,7 +764,7 @@ void FD31_FreeOfnW(LPOPENFILENAMEW ofnW) ...@@ -764,7 +764,7 @@ void FD31_FreeOfnW(LPOPENFILENAMEW ofnW)
HeapFree(GetProcessHeap(), 0, ofnW->lpstrFileTitle); HeapFree(GetProcessHeap(), 0, ofnW->lpstrFileTitle);
HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpstrInitialDir); HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpstrInitialDir);
HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpstrTitle); HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpstrTitle);
if ((ofnW->lpTemplateName) && (HIWORD(ofnW->lpTemplateName))) if (HIWORD(ofnW->lpTemplateName))
HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpTemplateName); HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpTemplateName);
} }
......
...@@ -370,7 +370,7 @@ static void codeview_clear_type_table(void) ...@@ -370,7 +370,7 @@ static void codeview_clear_type_table(void)
for (i = 0; i < CV_MAX_MODULES; i++) for (i = 0; i < CV_MAX_MODULES; i++)
{ {
if (cv_zmodules[i].allowed && cv_zmodules[i].defined_types) if (cv_zmodules[i].allowed)
HeapFree(GetProcessHeap(), 0, cv_zmodules[i].defined_types); HeapFree(GetProcessHeap(), 0, cv_zmodules[i].defined_types);
cv_zmodules[i].allowed = FALSE; cv_zmodules[i].allowed = FALSE;
cv_zmodules[i].defined_types = NULL; cv_zmodules[i].defined_types = NULL;
......
...@@ -536,7 +536,7 @@ Main_IDirect3DExecuteBufferImpl_1_Release(LPDIRECT3DEXECUTEBUFFER iface) ...@@ -536,7 +536,7 @@ Main_IDirect3DExecuteBufferImpl_1_Release(LPDIRECT3DEXECUTEBUFFER iface)
TRACE("(%p/%p)->()decrementing from %lu.\n", This, iface, ref + 1); TRACE("(%p/%p)->()decrementing from %lu.\n", This, iface, ref + 1);
if (!ref) { if (!ref) {
if ((This->desc.lpData != NULL) && This->need_free) if (This->need_free)
HeapFree(GetProcessHeap(),0,This->desc.lpData); HeapFree(GetProcessHeap(),0,This->desc.lpData);
HeapFree(GetProcessHeap(),0,This->vertex_data); HeapFree(GetProcessHeap(),0,This->vertex_data);
HeapFree(GetProcessHeap(),0,This->indices); HeapFree(GetProcessHeap(),0,This->indices);
......
...@@ -732,7 +732,7 @@ BOOL GDI_FreeObject( HGDIOBJ handle, void *ptr ) ...@@ -732,7 +732,7 @@ BOOL GDI_FreeObject( HGDIOBJ handle, void *ptr )
object->wMagic = 0; /* Mark it as invalid */ object->wMagic = 0; /* Mark it as invalid */
object->funcs = NULL; object->funcs = NULL;
i = ((ULONG_PTR)handle >> 2) - FIRST_LARGE_HANDLE; i = ((ULONG_PTR)handle >> 2) - FIRST_LARGE_HANDLE;
if (i >= 0 && i < MAX_LARGE_HANDLES && large_handles[i]) if (i >= 0 && i < MAX_LARGE_HANDLES)
{ {
HeapFree( GetProcessHeap(), 0, large_handles[i] ); HeapFree( GetProcessHeap(), 0, large_handles[i] );
large_handles[i] = NULL; large_handles[i] = NULL;
......
...@@ -1231,10 +1231,8 @@ static DWORD MIDI_mciRecord(UINT wDevID, DWORD dwFlags, LPMCI_RECORD_PARMS lpPar ...@@ -1231,10 +1231,8 @@ static DWORD MIDI_mciRecord(UINT wDevID, DWORD dwFlags, LPMCI_RECORD_PARMS lpPar
TRACE("Before MIDM_UNPREPARE\n"); TRACE("Before MIDM_UNPREPARE\n");
dwRet = midiInUnprepareHeader((HMIDIIN)wmm->hMidi, &midiHdr, sizeof(MIDIHDR)); dwRet = midiInUnprepareHeader((HMIDIIN)wmm->hMidi, &midiHdr, sizeof(MIDIHDR));
TRACE("After MIDM_UNPREPARE\n"); TRACE("After MIDM_UNPREPARE\n");
if (midiHdr.lpData != NULL) { HeapFree(GetProcessHeap(), 0, midiHdr.lpData);
HeapFree(GetProcessHeap(), 0, midiHdr.lpData); midiHdr.lpData = NULL;
midiHdr.lpData = NULL;
}
wmm->dwStatus = MCI_MODE_STOP; wmm->dwStatus = MCI_MODE_STOP;
if (lpParms && (dwFlags & MCI_NOTIFY)) { if (lpParms && (dwFlags & MCI_NOTIFY)) {
TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback); TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
......
...@@ -653,7 +653,7 @@ DWORD WINAPI WNetOpenEnumA( DWORD dwScope, DWORD dwType, DWORD dwUsage, ...@@ -653,7 +653,7 @@ DWORD WINAPI WNetOpenEnumA( DWORD dwScope, DWORD dwType, DWORD dwUsage,
if (ret == WN_SUCCESS) if (ret == WN_SUCCESS)
ret = WNetOpenEnumW(dwScope, dwType, dwUsage, lpNetWide, ret = WNetOpenEnumW(dwScope, dwType, dwUsage, lpNetWide,
lphEnum); lphEnum);
if (allocated && lpNetWide) if (allocated)
HeapFree(GetProcessHeap(), 0, lpNetWide); HeapFree(GetProcessHeap(), 0, lpNetWide);
} }
else else
......
...@@ -1004,22 +1004,14 @@ void VFWAPI ICCompressorFree(PCOMPVARS pc) ...@@ -1004,22 +1004,14 @@ void VFWAPI ICCompressorFree(PCOMPVARS pc)
ICClose(pc->hic); ICClose(pc->hic);
pc->hic = NULL; pc->hic = NULL;
} }
if (pc->lpbiIn != NULL) { HeapFree(GetProcessHeap(), 0, pc->lpbiIn);
HeapFree(GetProcessHeap(), 0, pc->lpbiIn); pc->lpbiIn = NULL;
pc->lpbiIn = NULL; HeapFree(GetProcessHeap(), 0, pc->lpBitsOut);
} pc->lpBitsOut = NULL;
if (pc->lpBitsOut != NULL) { HeapFree(GetProcessHeap(), 0, pc->lpBitsPrev);
HeapFree(GetProcessHeap(), 0, pc->lpBitsOut); pc->lpBitsPrev = NULL;
pc->lpBitsOut = NULL; HeapFree(GetProcessHeap(), 0, pc->lpState);
} pc->lpState = NULL;
if (pc->lpBitsPrev != NULL) {
HeapFree(GetProcessHeap(), 0, pc->lpBitsPrev);
pc->lpBitsPrev = NULL;
}
if (pc->lpState != NULL) {
HeapFree(GetProcessHeap(), 0, pc->lpState);
pc->lpState = NULL;
}
pc->dwFlags = 0; pc->dwFlags = 0;
} }
} }
......
...@@ -802,7 +802,7 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size) ...@@ -802,7 +802,7 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size)
if (reqsize) memcpy(buffer, ins_str, reqsize); if (reqsize) memcpy(buffer, ins_str, reqsize);
reqsize += deplen; reqsize += deplen;
if (ins_str && ins_str != tmp && ins_str != cd->Buffer) if (ins_str != tmp && ins_str != cd->Buffer)
RtlFreeHeap(GetProcessHeap(), 0, ins_str); RtlFreeHeap(GetProcessHeap(), 0, ins_str);
collapse_path( buffer, mark ); collapse_path( buffer, mark );
......
...@@ -455,7 +455,7 @@ static UINT ICO_ExtractIconExW( ...@@ -455,7 +455,7 @@ static UINT ICO_ExtractIconExW(
if (nIcons == 0) if (nIcons == 0)
{ {
ret = iconDirCount; ret = iconDirCount;
if (lpiID && pCIDir) /* *.ico file, deallocate heap pointer*/ if (lpiID) /* *.ico file, deallocate heap pointer*/
HeapFree(GetProcessHeap(), 0, pCIDir); HeapFree(GetProcessHeap(), 0, pCIDir);
} }
else if (nIconIndex < iconDirCount) else if (nIconIndex < iconDirCount)
...@@ -472,7 +472,7 @@ static UINT ICO_ExtractIconExW( ...@@ -472,7 +472,7 @@ static UINT ICO_ExtractIconExW(
pIconId[i] = LookupIconIdFromDirectoryEx(pCIDir, TRUE, cx1, cy1, flags); pIconId[i] = LookupIconIdFromDirectoryEx(pCIDir, TRUE, cx1, cy1, flags);
if (cx2 && cy2) pIconId[++i] = LookupIconIdFromDirectoryEx(pCIDir, TRUE, cx2, cy2, flags); if (cx2 && cy2) pIconId[++i] = LookupIconIdFromDirectoryEx(pCIDir, TRUE, cx2, cy2, flags);
} }
if (lpiID && pCIDir) /* *.ico file, deallocate heap pointer*/ if (lpiID) /* *.ico file, deallocate heap pointer*/
HeapFree(GetProcessHeap(), 0, pCIDir); HeapFree(GetProcessHeap(), 0, pCIDir);
for (icon = 0; icon < nIcons; icon++) for (icon = 0; icon < nIcons; icon++)
......
...@@ -1652,7 +1652,7 @@ static void LISTBOX_DeleteItem( LB_DESCR *descr, INT index ) ...@@ -1652,7 +1652,7 @@ static void LISTBOX_DeleteItem( LB_DESCR *descr, INT index )
dis.itemData = descr->items[index].data; dis.itemData = descr->items[index].data;
SendMessageW( descr->owner, WM_DELETEITEM, id, (LPARAM)&dis ); SendMessageW( descr->owner, WM_DELETEITEM, id, (LPARAM)&dis );
} }
if (HAS_STRINGS(descr) && descr->items[index].str) if (HAS_STRINGS(descr))
HeapFree( GetProcessHeap(), 0, descr->items[index].str ); HeapFree( GetProcessHeap(), 0, descr->items[index].str );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment