Commit ed79f458 authored by Kirill K. Smirnov's avatar Kirill K. Smirnov Committed by Alexandre Julliard

mciavi32: Propely handle Heap[Re]Alloc failure.

parent 407c5770
......@@ -229,14 +229,16 @@ static BOOL MCIAVI_AddFrame(WINE_MCIAVI* wma, LPMMCKINFO mmck,
alb->numAudioBlocks, mmck->cksize);
if (wma->lpWaveFormat) {
if (alb->numAudioBlocks >= alb->numAudioAllocated) {
alb->numAudioAllocated += 32;
if (!wma->lpAudioIndex)
wma->lpAudioIndex = HeapAlloc(GetProcessHeap(), 0,
alb->numAudioAllocated * sizeof(struct MMIOPos));
else
wma->lpAudioIndex = HeapReAlloc(GetProcessHeap(), 0, wma->lpAudioIndex,
alb->numAudioAllocated * sizeof(struct MMIOPos));
if (!wma->lpAudioIndex) return FALSE;
DWORD newsize = alb->numAudioAllocated + 32;
struct MMIOPos* newindex;
if (!wma->lpAudioIndex)
newindex = HeapAlloc(GetProcessHeap(), 0, newsize * sizeof(struct MMIOPos));
else
newindex = HeapReAlloc(GetProcessHeap(), 0, wma->lpAudioIndex, newsize * sizeof(struct MMIOPos));
if (!newindex) return FALSE;
alb->numAudioAllocated = newsize;
wma->lpAudioIndex = newindex;
}
wma->lpAudioIndex[alb->numAudioBlocks].dwOffset = mmck->dwDataOffset;
wma->lpAudioIndex[alb->numAudioBlocks].dwSize = mmck->cksize;
......
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