[PATCH 1/2] dsound: Correctly update buflen.
Huw Davies
huw at codeweavers.com
Sun Feb 26 11:42:21 CST 2017
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
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
More information about the wine-patches
mailing list