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;