wineoss: Properly allocate the WAVEFORMATEXTENSIBLE returned by GetMixFormat.

This commit is contained in:
Jörg Höhle 2011-06-05 10:32:10 +02:00 committed by Alexandre Julliard
parent 8337ffb727
commit f68a36c87b
1 changed files with 7 additions and 6 deletions

View File

@ -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;