[PATCH] xaudio2_7: Correct reference count on newly created XAudio2 object

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Mon Mar 9 03:58:29 CDT 2020


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 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dlls/xaudio2_7/xaudio_dll.c b/dlls/xaudio2_7/xaudio_dll.c
index a87e0124d3..1a440072cb 100644
--- a/dlls/xaudio2_7/xaudio_dll.c
+++ b/dlls/xaudio2_7/xaudio_dll.c
@@ -1961,6 +1961,7 @@ static HRESULT WINAPI XAudio2CF_CreateInstance(IClassFactory *iface, IUnknown *p
         HeapFree(GetProcessHeap(), 0, object);
         return hr;
     }
+    IXAudio2_Release(&object->IXAudio2_iface);
 
     TRACE("Created XAudio version %u: %p\n", 20 + XAUDIO2_VER, object);
 
-- 
2.25.1




More information about the wine-devel mailing list