Jörg Höhle : winealsa: Properly allocate the WAVEFORMATEXTENSIBLE returned by GetMixFormat.
Alexandre Julliard
julliard at winehq.org
Mon Jun 6 15:19:10 CDT 2011
Module: wine
Branch: master
Commit: d726cf881941afa61d6e5f976d0880be01d06919
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d726cf881941afa61d6e5f976d0880be01d06919
Author: Jörg Höhle <hoehle at users.sourceforge.net>
Date: Sat Jun 4 11:55:06 2011 +0200
winealsa: Properly allocate the WAVEFORMATEXTENSIBLE returned by GetMixFormat.
---
dlls/winealsa.drv/mmdevdrv.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c
index 1a6d58f..f49df77 100644
--- a/dlls/winealsa.drv/mmdevdrv.c
+++ b/dlls/winealsa.drv/mmdevdrv.c
@@ -1217,16 +1217,15 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient *iface,
if(!pwfx)
return E_POINTER;
+ *pwfx = NULL;
- *pwfx = HeapAlloc(GetProcessHeap(), 0, sizeof(WAVEFORMATEXTENSIBLE));
- if(!*pwfx)
+ fmt = CoTaskMemAlloc(sizeof(WAVEFORMATEXTENSIBLE));
+ if(!fmt)
return E_OUTOFMEMORY;
- fmt = (WAVEFORMATEXTENSIBLE*)*pwfx;
-
formats = HeapAlloc(GetProcessHeap(), 0, snd_pcm_format_mask_sizeof());
if(!formats){
- HeapFree(GetProcessHeap(), 0, *pwfx);
+ CoTaskMemFree(fmt);
return E_OUTOFMEMORY;
}
@@ -1310,11 +1309,12 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient *iface,
fmt->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
dump_fmt((WAVEFORMATEX*)fmt);
+ *pwfx = (WAVEFORMATEX*)fmt;
exit:
LeaveCriticalSection(&This->lock);
if(FAILED(hr))
- HeapFree(GetProcessHeap(), 0, *pwfx);
+ CoTaskMemFree(fmt);
HeapFree(GetProcessHeap(), 0, formats);
return hr;
More information about the wine-cvs
mailing list