From: Huw Davies Subject: [PATCH 1/2] dsound: Correctly update buflen. Message-Id: <20170226174222.62137-1-huw@codeweavers.com> Date: Sun, 26 Feb 2017 17:42:21 +0000 Signed-off-by: Huw Davies --- dlls/dsound/primary.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c index f5a1020..ed41a5c 100644 --- a/dlls/dsound/primary.c +++ b/dlls/dsound/primary.c @@ -250,18 +250,18 @@ static HRESULT DSOUND_PrimaryOpen(DirectSoundDevice *device, WAVEFORMATEX *wfx, } FillMemory(newbuf, new_buflen, (wfx->wBitsPerSample == 8) ? 128 : 0); } else if (!mixfloat) { - DWORD alloc_len = frames * sizeof(float); + new_buflen = frames * sizeof(float); if (device->buffer) - newbuf = HeapReAlloc(GetProcessHeap(), 0, device->buffer, alloc_len); + newbuf = HeapReAlloc(GetProcessHeap(), 0, device->buffer, new_buflen); else - newbuf = HeapAlloc(GetProcessHeap(), 0, alloc_len); + newbuf = HeapAlloc(GetProcessHeap(), 0, new_buflen); if (!newbuf) { ERR("failed to allocate primary buffer\n"); return DSERR_OUTOFMEMORY; } - FillMemory(newbuf, alloc_len, (wfx->wBitsPerSample == 8) ? 128 : 0); + FillMemory(newbuf, new_buflen, (wfx->wBitsPerSample == 8) ? 128 : 0); } else { HeapFree(GetProcessHeap(), 0, device->buffer); newbuf = NULL; -- 2.10.2