Yet another round of redundant NULL checks before HeapFree.
This commit is contained in:
parent
24beabfd4e
commit
fee72b607a
|
@ -175,14 +175,10 @@ static ULONG WINAPI ACMStream_fnRelease(IAVIStream* iface)
|
|||
acmStreamClose(This->has, 0);
|
||||
This->has = NULL;
|
||||
}
|
||||
if (This->acmStreamHdr.pbSrc != NULL) {
|
||||
HeapFree(GetProcessHeap(), 0, This->acmStreamHdr.pbSrc);
|
||||
This->acmStreamHdr.pbSrc = NULL;
|
||||
}
|
||||
if (This->acmStreamHdr.pbDst != NULL) {
|
||||
HeapFree(GetProcessHeap(), 0, This->acmStreamHdr.pbDst);
|
||||
This->acmStreamHdr.pbDst = NULL;
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, This->acmStreamHdr.pbSrc);
|
||||
This->acmStreamHdr.pbSrc = NULL;
|
||||
HeapFree(GetProcessHeap(), 0, This->acmStreamHdr.pbDst);
|
||||
This->acmStreamHdr.pbDst = NULL;
|
||||
if (This->lpInFormat != NULL) {
|
||||
HeapFree(GetProcessHeap(), 0, This->lpInFormat);
|
||||
This->lpInFormat = NULL;
|
||||
|
|
|
@ -326,10 +326,9 @@ static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface)
|
|||
This->fileextra.cb = 0;
|
||||
}
|
||||
|
||||
if (This->szFileName != NULL) {
|
||||
HeapFree(GetProcessHeap(), 0, This->szFileName);
|
||||
This->szFileName = NULL;
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, This->szFileName);
|
||||
This->szFileName = NULL;
|
||||
|
||||
if (This->hmmio != NULL) {
|
||||
mmioClose(This->hmmio, 0);
|
||||
This->hmmio = NULL;
|
||||
|
@ -1565,10 +1564,8 @@ static void AVIFILE_DestructAVIStream(IAVIStreamImpl *This)
|
|||
This->idxFrames = NULL;
|
||||
This->nIdxFrames = 0;
|
||||
}
|
||||
if (This->idxFmtChanges != NULL) {
|
||||
HeapFree(GetProcessHeap(), 0, This->idxFmtChanges);
|
||||
This->idxFmtChanges = NULL;
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, This->idxFmtChanges);
|
||||
This->idxFmtChanges = NULL;
|
||||
if (This->lpBuffer != NULL) {
|
||||
HeapFree(GetProcessHeap(), 0, This->lpBuffer);
|
||||
This->lpBuffer = NULL;
|
||||
|
|
|
@ -97,14 +97,12 @@ typedef struct _IGetFrameImpl {
|
|||
|
||||
static void AVIFILE_CloseCompressor(IGetFrameImpl *This)
|
||||
{
|
||||
if (This->lpOutFormat != NULL && This->lpInFormat != This->lpOutFormat) {
|
||||
if (This->lpInFormat != This->lpOutFormat) {
|
||||
HeapFree(GetProcessHeap(), 0, This->lpOutFormat);
|
||||
This->lpOutFormat = NULL;
|
||||
}
|
||||
if (This->lpInFormat != NULL) {
|
||||
HeapFree(GetProcessHeap(), 0, This->lpInFormat);
|
||||
This->lpInFormat = NULL;
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, This->lpInFormat);
|
||||
This->lpInFormat = NULL;
|
||||
if (This->hic != NULL) {
|
||||
if (This->bResize)
|
||||
ICDecompressExEnd(This->hic);
|
||||
|
|
|
@ -297,10 +297,8 @@ static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface)
|
|||
This->extra.lp = NULL;
|
||||
This->extra.cb = 0;
|
||||
}
|
||||
if (This->szFileName != NULL) {
|
||||
HeapFree(GetProcessHeap(), 0, This->szFileName);
|
||||
This->szFileName = NULL;
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, This->szFileName);
|
||||
This->szFileName = NULL;
|
||||
if (This->hmmio != NULL) {
|
||||
mmioClose(This->hmmio, 0);
|
||||
This->hmmio = NULL;
|
||||
|
|
|
@ -764,7 +764,7 @@ void FD31_FreeOfnW(LPOPENFILENAMEW ofnW)
|
|||
HeapFree(GetProcessHeap(), 0, ofnW->lpstrFileTitle);
|
||||
HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpstrInitialDir);
|
||||
HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpstrTitle);
|
||||
if ((ofnW->lpTemplateName) && (HIWORD(ofnW->lpTemplateName)))
|
||||
if (HIWORD(ofnW->lpTemplateName))
|
||||
HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpTemplateName);
|
||||
}
|
||||
|
||||
|
|
|
@ -370,7 +370,7 @@ static void codeview_clear_type_table(void)
|
|||
|
||||
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);
|
||||
cv_zmodules[i].allowed = FALSE;
|
||||
cv_zmodules[i].defined_types = NULL;
|
||||
|
|
|
@ -536,7 +536,7 @@ Main_IDirect3DExecuteBufferImpl_1_Release(LPDIRECT3DEXECUTEBUFFER iface)
|
|||
TRACE("(%p/%p)->()decrementing from %lu.\n", This, iface, ref + 1);
|
||||
|
||||
if (!ref) {
|
||||
if ((This->desc.lpData != NULL) && This->need_free)
|
||||
if (This->need_free)
|
||||
HeapFree(GetProcessHeap(),0,This->desc.lpData);
|
||||
HeapFree(GetProcessHeap(),0,This->vertex_data);
|
||||
HeapFree(GetProcessHeap(),0,This->indices);
|
||||
|
|
|
@ -732,7 +732,7 @@ BOOL GDI_FreeObject( HGDIOBJ handle, void *ptr )
|
|||
object->wMagic = 0; /* Mark it as invalid */
|
||||
object->funcs = NULL;
|
||||
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] );
|
||||
large_handles[i] = NULL;
|
||||
|
|
|
@ -1231,10 +1231,8 @@ static DWORD MIDI_mciRecord(UINT wDevID, DWORD dwFlags, LPMCI_RECORD_PARMS lpPar
|
|||
TRACE("Before MIDM_UNPREPARE\n");
|
||||
dwRet = midiInUnprepareHeader((HMIDIIN)wmm->hMidi, &midiHdr, sizeof(MIDIHDR));
|
||||
TRACE("After MIDM_UNPREPARE\n");
|
||||
if (midiHdr.lpData != NULL) {
|
||||
HeapFree(GetProcessHeap(), 0, midiHdr.lpData);
|
||||
midiHdr.lpData = NULL;
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, midiHdr.lpData);
|
||||
midiHdr.lpData = NULL;
|
||||
wmm->dwStatus = MCI_MODE_STOP;
|
||||
if (lpParms && (dwFlags & MCI_NOTIFY)) {
|
||||
TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
|
||||
|
|
|
@ -653,7 +653,7 @@ DWORD WINAPI WNetOpenEnumA( DWORD dwScope, DWORD dwType, DWORD dwUsage,
|
|||
if (ret == WN_SUCCESS)
|
||||
ret = WNetOpenEnumW(dwScope, dwType, dwUsage, lpNetWide,
|
||||
lphEnum);
|
||||
if (allocated && lpNetWide)
|
||||
if (allocated)
|
||||
HeapFree(GetProcessHeap(), 0, lpNetWide);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1004,22 +1004,14 @@ void VFWAPI ICCompressorFree(PCOMPVARS pc)
|
|||
ICClose(pc->hic);
|
||||
pc->hic = NULL;
|
||||
}
|
||||
if (pc->lpbiIn != NULL) {
|
||||
HeapFree(GetProcessHeap(), 0, pc->lpbiIn);
|
||||
pc->lpbiIn = NULL;
|
||||
}
|
||||
if (pc->lpBitsOut != NULL) {
|
||||
HeapFree(GetProcessHeap(), 0, pc->lpBitsOut);
|
||||
pc->lpBitsOut = 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;
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, pc->lpbiIn);
|
||||
pc->lpbiIn = NULL;
|
||||
HeapFree(GetProcessHeap(), 0, pc->lpBitsOut);
|
||||
pc->lpBitsOut = NULL;
|
||||
HeapFree(GetProcessHeap(), 0, pc->lpBitsPrev);
|
||||
pc->lpBitsPrev = NULL;
|
||||
HeapFree(GetProcessHeap(), 0, pc->lpState);
|
||||
pc->lpState = NULL;
|
||||
pc->dwFlags = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -802,7 +802,7 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size)
|
|||
if (reqsize) memcpy(buffer, ins_str, reqsize);
|
||||
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);
|
||||
|
||||
collapse_path( buffer, mark );
|
||||
|
|
|
@ -455,7 +455,7 @@ static UINT ICO_ExtractIconExW(
|
|||
if (nIcons == 0)
|
||||
{
|
||||
ret = iconDirCount;
|
||||
if (lpiID && pCIDir) /* *.ico file, deallocate heap pointer*/
|
||||
if (lpiID) /* *.ico file, deallocate heap pointer*/
|
||||
HeapFree(GetProcessHeap(), 0, pCIDir);
|
||||
}
|
||||
else if (nIconIndex < iconDirCount)
|
||||
|
@ -472,7 +472,7 @@ static UINT ICO_ExtractIconExW(
|
|||
pIconId[i] = LookupIconIdFromDirectoryEx(pCIDir, TRUE, cx1, cy1, 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);
|
||||
|
||||
for (icon = 0; icon < nIcons; icon++)
|
||||
|
|
|
@ -1652,7 +1652,7 @@ static void LISTBOX_DeleteItem( LB_DESCR *descr, INT index )
|
|||
dis.itemData = descr->items[index].data;
|
||||
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 );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue