From 3076192e7de3c988e140da7003bd60c937c6ac8d Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Sun, 26 Feb 2017 17:42:21 +0000 Subject: [PATCH] dsound: Correctly update buflen. Signed-off-by: Huw Davies Signed-off-by: Andrew Eikum Signed-off-by: Alexandre Julliard --- 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 f5a1020700a..ed41a5c4844 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;