Andrew Eikum : winecoreaudio.drv: Properly allocate and free the WAVEFORMATEX returned by IsFormatSupported.

Alexandre Julliard julliard at winehq.org
Wed Apr 27 12:47:29 CDT 2011


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

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Wed Apr 27 09:12:48 2011 -0500

winecoreaudio.drv: Properly allocate and free the WAVEFORMATEX returned by IsFormatSupported.

---

 dlls/winecoreaudio.drv/mmdevdrv.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c
index 216854a..10201e7 100644
--- a/dlls/winecoreaudio.drv/mmdevdrv.c
+++ b/dlls/winecoreaudio.drv/mmdevdrv.c
@@ -417,7 +417,7 @@ static ULONG WINAPI AudioClient_Release(IAudioClient *iface)
         if(This->aqueue)
             AudioQueueDispose(This->aqueue, 1);
         HeapFree(GetProcessHeap(), 0, This->public_buffer);
-        HeapFree(GetProcessHeap(), 0, This->fmt);
+        CoTaskMemFree(This->fmt);
         IMMDevice_Release(This->parent);
         HeapFree(GetProcessHeap(), 0, This);
     }
@@ -498,7 +498,7 @@ static WAVEFORMATEX *clone_format(const WAVEFORMATEX *fmt)
     else
         size = sizeof(WAVEFORMATEX);
 
-    ret = HeapAlloc(GetProcessHeap(), 0, size);
+    ret = CoTaskMemAlloc(size);
     if(!ret)
         return NULL;
 
@@ -700,6 +700,8 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
             if(!buf){
                 AudioQueueDispose(This->aqueue, 1);
                 This->aqueue = NULL;
+                CoTaskMemFree(This->fmt);
+                This->fmt = NULL;
                 OSSpinLockUnlock(&This->lock);
                 return E_OUTOFMEMORY;
             }
@@ -708,6 +710,8 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
             if(sc != noErr){
                 AudioQueueDispose(This->aqueue, 1);
                 This->aqueue = NULL;
+                CoTaskMemFree(This->fmt);
+                This->fmt = NULL;
                 OSSpinLockUnlock(&This->lock);
                 WARN("Couldn't allocate buffer: %lx\n", sc);
                 return E_FAIL;




More information about the wine-cvs mailing list