mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
avifil32: Don't leak the buffer on HeapReAlloc() failure in AVIFILE_ReadBlock().
This commit is contained in:
parent
1fb72a37eb
commit
c274d6f06e
@ -2030,12 +2030,14 @@ static HRESULT AVIFILE_ReadBlock(IAVIStreamImpl *This, DWORD pos,
|
||||
if (This->lpBuffer == NULL || This->cbBuffer < size) {
|
||||
DWORD maxSize = max(size, This->sInfo.dwSuggestedBufferSize);
|
||||
|
||||
if (This->lpBuffer == NULL)
|
||||
if (This->lpBuffer == NULL) {
|
||||
This->lpBuffer = HeapAlloc(GetProcessHeap(), 0, maxSize);
|
||||
else
|
||||
This->lpBuffer = HeapReAlloc(GetProcessHeap(), 0, This->lpBuffer, maxSize);
|
||||
if (This->lpBuffer == NULL)
|
||||
return AVIERR_MEMORY;
|
||||
if (!This->lpBuffer) return AVIERR_MEMORY;
|
||||
} else {
|
||||
void *new_buffer = HeapReAlloc(GetProcessHeap(), 0, This->lpBuffer, maxSize);
|
||||
if (!new_buffer) return AVIERR_MEMORY;
|
||||
This->lpBuffer = new_buffer;
|
||||
}
|
||||
This->cbBuffer = maxSize;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user