Huw Davies : dsound: Correctly update buflen.

Alexandre Julliard julliard at winehq.org
Mon Feb 27 15:12:09 CST 2017


Module: wine
Branch: master
Commit: 3076192e7de3c988e140da7003bd60c937c6ac8d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3076192e7de3c988e140da7003bd60c937c6ac8d

Author: Huw Davies <huw at codeweavers.com>
Date:   Sun Feb 26 17:42:21 2017 +0000

dsound: Correctly update buflen.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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;




More information about the wine-cvs mailing list