mciavi32: Propely handle Heap[Re]Alloc failure.

Signed-off-by: Kirill K. Smirnov <kirill.k.smirnov@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Kirill K. Smirnov 2016-05-08 19:10:44 +03:00 committed by Alexandre Julliard
parent 407c577054
commit ed79f45817
1 changed files with 10 additions and 8 deletions

View File

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