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, ...@@ -1913,7 +1913,7 @@ HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
hres = AVIStreamReadFormat(pInStreams[curStream], sInfo.dwStart, hres = AVIStreamReadFormat(pInStreams[curStream], sInfo.dwStart,
lpBuffer, &lBufferSize); lpBuffer, &lBufferSize);
if (FAILED(hres)) if (FAILED(hres))
return hres; goto error;
AVIStreamSetFormat(pOutStreams[curStream], sInfo.dwStart, AVIStreamSetFormat(pOutStreams[curStream], sInfo.dwStart,
lpBuffer, lBufferSize); lpBuffer, lBufferSize);
......
...@@ -1018,14 +1018,15 @@ static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos, ...@@ -1018,14 +1018,15 @@ static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos,
lppc->peNew[n].peFlags = 0; lppc->peNew[n].peFlags = 0;
} }
if (mmioSeek(This->paf->hmmio, This->paf->dwNextFramePos, SEEK_SET) == -1) if (mmioSeek(This->paf->hmmio, This->paf->dwNextFramePos, SEEK_SET) == -1 ||
return AVIERR_FILEWRITE; mmioCreateChunk(This->paf->hmmio, &ck, 0) != S_OK ||
if (mmioCreateChunk(This->paf->hmmio, &ck, 0) != S_OK) mmioWrite(This->paf->hmmio, (HPSTR)lppc, ck.cksize) != ck.cksize ||
return AVIERR_FILEWRITE; mmioAscend(This->paf->hmmio, &ck, 0) != S_OK)
if (mmioWrite(This->paf->hmmio, (HPSTR)lppc, ck.cksize) != ck.cksize) {
return AVIERR_FILEWRITE; HeapFree(GetProcessHeap(), 0, lppc);
if (mmioAscend(This->paf->hmmio, &ck, 0) != S_OK)
return AVIERR_FILEWRITE; return AVIERR_FILEWRITE;
}
This->paf->dwNextFramePos += ck.cksize + 2 * sizeof(DWORD); This->paf->dwNextFramePos += ck.cksize + 2 * sizeof(DWORD);
HeapFree(GetProcessHeap(), 0, lppc); HeapFree(GetProcessHeap(), 0, lppc);
...@@ -1939,6 +1940,7 @@ static HRESULT AVIFILE_LoadIndex(const IAVIFileImpl *This, DWORD size, DWORD off ...@@ -1939,6 +1940,7 @@ static HRESULT AVIFILE_LoadIndex(const IAVIFileImpl *This, DWORD size, DWORD off
HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pStream->nIdxFrames * sizeof(AVIINDEXENTRY)); HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pStream->nIdxFrames * sizeof(AVIINDEXENTRY));
if (pStream->idxFrames == NULL && pStream->nIdxFrames > 0) { if (pStream->idxFrames == NULL && pStream->nIdxFrames > 0) {
pStream->nIdxFrames = 0; pStream->nIdxFrames = 0;
HeapFree(GetProcessHeap(), 0, lp);
return AVIERR_MEMORY; 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