From f68a36c87b475a53f3dcc5080a12e87d40399308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20H=C3=B6hle?= Date: Sun, 5 Jun 2011 10:32:10 +0200 Subject: [PATCH] wineoss: Properly allocate the WAVEFORMATEXTENSIBLE returned by GetMixFormat. --- dlls/wineoss.drv/mmdevdrv.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index b372b64616e..7e354fe82cb 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;