Jörg Höhle : wineoss: 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: f68a36c87b475a53f3dcc5080a12e87d40399308
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f68a36c87b475a53f3dcc5080a12e87d40399308
Author: Jörg Höhle <hoehle at users.sourceforge.net>
Date: Sun Jun 5 10:32:10 2011 +0200
wineoss: Properly allocate the WAVEFORMATEXTENSIBLE returned by GetMixFormat.
---
dlls/wineoss.drv/mmdevdrv.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c
index b372b64..7e354fe 100644
--- a/dlls/wineoss.drv/mmdevdrv.c
+++ b/dlls/wineoss.drv/mmdevdrv.c
@@ -1025,12 +1025,7 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient *iface,
if(!pwfx)
return E_POINTER;
-
- *pwfx = HeapAlloc(GetProcessHeap(), 0, sizeof(WAVEFORMATEXTENSIBLE));
- if(!*pwfx)
- return E_OUTOFMEMORY;
-
- fmt = (WAVEFORMATEXTENSIBLE*)*pwfx;
+ *pwfx = NULL;
if(This->dataflow == eRender)
formats = This->ai.oformats;
@@ -1039,6 +1034,10 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient *iface,
else
return E_UNEXPECTED;
+ fmt = CoTaskMemAlloc(sizeof(WAVEFORMATEXTENSIBLE));
+ if(!fmt)
+ return E_OUTOFMEMORY;
+
fmt->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
if(formats & AFMT_S16_LE){
fmt->Format.wBitsPerSample = 16;
@@ -1059,6 +1058,7 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient *iface,
fmt->SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
}else{
ERR("Didn't recognize any available OSS formats: %x\n", formats);
+ CoTaskMemFree(fmt);
return E_FAIL;
}
@@ -1074,6 +1074,7 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient *iface,
fmt->Samples.wValidBitsPerSample = fmt->Format.wBitsPerSample;
fmt->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
+ *pwfx = (WAVEFORMATEX*)fmt;
dump_fmt(*pwfx);
return S_OK;
More information about the wine-cvs
mailing list