Commit 3d61013e authored by Andrew Talbot's avatar Andrew Talbot Committed by Alexandre Julliard

avifil32: Fix some memory leaks.

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