[PATCH v2] xaudio2_7: Correct reference count on newly created XAudio2 object
Andrew Eikum
aeikum at codeweavers.com
Tue Mar 10 10:29:15 CDT 2020
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
On Mon, Mar 09, 2020 at 09:22:19AM +0000, Alistair Leslie-Hughes wrote:
> FAudioCOMConstructWithCustomAllocatorEXT initialize the reference count
> to 1, then QueryInterface increase the count to 2. Thus the finial
> release wont be called if a balanced AddRef/Release is used.
>
> Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
> ---
> dlls/xaudio2_7/xaudio_dll.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/dlls/xaudio2_7/xaudio_dll.c b/dlls/xaudio2_7/xaudio_dll.c
> index a87e0124d3..fa0361182c 100644
> --- a/dlls/xaudio2_7/xaudio_dll.c
> +++ b/dlls/xaudio2_7/xaudio_dll.c
> @@ -1955,10 +1955,8 @@ static HRESULT WINAPI XAudio2CF_CreateInstance(IClassFactory *iface, IUnknown *p
> FAudio_RegisterForCallbacks(object->faudio, &object->FAudioEngineCallback_vtbl);
>
> hr = IXAudio2_QueryInterface(&object->IXAudio2_iface, riid, ppobj);
> + IXAudio2_Release(&object->IXAudio2_iface);
> if(FAILED(hr)){
> - object->lock.DebugInfo->Spare[0] = 0;
> - DeleteCriticalSection(&object->lock);
> - HeapFree(GetProcessHeap(), 0, object);
> return hr;
> }
>
> --
> 2.25.1
>
>
More information about the wine-devel
mailing list