Hi Vijay, On 24/7/20 9:43 pm, Vijay Kiran Kamuju wrote:
Based on patch from Ethan Lee.
Signed-off-by: Vijay Kiran Kamuju <infyquest(a)gmail.com>
These comments apply across the other patches are well.
+ hr = FACTAudioEngine_CreateSoundBank(This->fact_engine, pvBuffer, > dwSize, + dwFlags, dwAllocAttributes, &fsb); + if(FAILED(hr)) + return hr;
FAUdio doesn't always return a valid HRESULT, so please change to something like this. if (hr != S_OK) { ERR("FACTAudioEngine_CreateSoundBank Failed: %d\n", hr); return E_FAIL; }
+ + sb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*sb)); + if (!sb){ + FACTSoundBank_Destroy(fsb); + ERR("Failed to allocate XACT3SoundBankImpl!"); + return hr;
In this case you are return S_OK(hr) since CreateSoundBank was successful, but memory allocation failed, should return E_OUTOFMEMORY. Now hr variable can be easily factored out. For reference look at patch 0005 of xactengine-initial0005 in wine-staging. Regards Alistair.