avifil32: Fix some memory leaks.

This commit is contained in:
Andrew Talbot 2007-09-12 17:52:18 +01:00 committed by Alexandre Julliard
parent ae8e8a0a57
commit 3d61013e7c
2 changed files with 10 additions and 8 deletions

View file

@ -1913,7 +1913,7 @@ HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
hres = AVIStreamReadFormat(pInStreams[curStream], sInfo.dwStart,
lpBuffer, &lBufferSize);
if (FAILED(hres))
return hres;
goto error;
AVIStreamSetFormat(pOutStreams[curStream], sInfo.dwStart,
lpBuffer, lBufferSize);

View file

@ -1018,14 +1018,15 @@ static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos,
lppc->peNew[n].peFlags = 0;
}
if (mmioSeek(This->paf->hmmio, This->paf->dwNextFramePos, SEEK_SET) == -1)
return AVIERR_FILEWRITE;
if (mmioCreateChunk(This->paf->hmmio, &ck, 0) != S_OK)
return AVIERR_FILEWRITE;
if (mmioWrite(This->paf->hmmio, (HPSTR)lppc, ck.cksize) != ck.cksize)
return AVIERR_FILEWRITE;
if (mmioAscend(This->paf->hmmio, &ck, 0) != S_OK)
if (mmioSeek(This->paf->hmmio, This->paf->dwNextFramePos, SEEK_SET) == -1 ||
mmioCreateChunk(This->paf->hmmio, &ck, 0) != S_OK ||
mmioWrite(This->paf->hmmio, (HPSTR)lppc, ck.cksize) != ck.cksize ||
mmioAscend(This->paf->hmmio, &ck, 0) != S_OK)
{
HeapFree(GetProcessHeap(), 0, lppc);
return AVIERR_FILEWRITE;
}
This->paf->dwNextFramePos += ck.cksize + 2 * sizeof(DWORD);
HeapFree(GetProcessHeap(), 0, lppc);
@ -1939,6 +1940,7 @@ static HRESULT AVIFILE_LoadIndex(const IAVIFileImpl *This, DWORD size, DWORD off
HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pStream->nIdxFrames * sizeof(AVIINDEXENTRY));
if (pStream->idxFrames == NULL && pStream->nIdxFrames > 0) {
pStream->nIdxFrames = 0;
HeapFree(GetProcessHeap(), 0, lp);
return AVIERR_MEMORY;
}
}