Commit 7ab71039 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

avifil32: Don't leak the buffer on HeapReAlloc() failure in AVIFILE_AddFrame().

Perhaps the code should also just double the buffer. I can send another patch for that if needed.
parent 63aa5418
......@@ -1383,16 +1383,20 @@ static HRESULT AVIFILE_AddFrame(IAVIStreamImpl *This, DWORD ckid, DWORD size, DW
}
if (This->idxFmtChanges == NULL || This->nIdxFmtChanges <= This->sInfo.dwFormatChangeCount) {
This->nIdxFmtChanges += 16;
if (This->idxFmtChanges == NULL)
This->idxFmtChanges =
HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->nIdxFmtChanges * sizeof(AVIINDEXENTRY));
else
DWORD new_count = This->nIdxFmtChanges + 16;
void *new_buffer;
if (This->idxFmtChanges == NULL) {
This->idxFmtChanges =
HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->idxFmtChanges,
This->nIdxFmtChanges * sizeof(AVIINDEXENTRY));
if (This->idxFmtChanges == NULL)
return AVIERR_MEMORY;
HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, new_count * sizeof(AVIINDEXENTRY));
if (!This->idxFmtChanges) return AVIERR_MEMORY;
} else {
new_buffer = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->idxFmtChanges,
new_count * sizeof(AVIINDEXENTRY));
if (!new_buffer) return AVIERR_MEMORY;
This->idxFmtChanges = new_buffer;
}
This->nIdxFmtChanges = new_count;
}
This->sInfo.dwFlags |= AVISTREAMINFO_FORMATCHANGES;
......
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