From a7178d5a11913e7d111b8c21f63ab6a79df203ff Mon Sep 17 00:00:00 2001 From: Shmueli Englard Date: Wed, 28 Aug 2024 21:41:01 -0700 Subject: [PATCH] Release unknown after QI --- src/Shmuelie.WinRTServer/Internal/BaseClassFactoryWrapper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Shmuelie.WinRTServer/Internal/BaseClassFactoryWrapper.cs b/src/Shmuelie.WinRTServer/Internal/BaseClassFactoryWrapper.cs index fbc65bb..963764f 100644 --- a/src/Shmuelie.WinRTServer/Internal/BaseClassFactoryWrapper.cs +++ b/src/Shmuelie.WinRTServer/Internal/BaseClassFactoryWrapper.cs @@ -35,6 +35,7 @@ public unsafe HRESULT CreateInstance(void* pUnkOuter, Guid* riid, void** ppvObje else { HRESULT hr = (HRESULT)Marshal.QueryInterface(unknown, ref *riid, out nint ppv); + Marshal.Release(unknown); if (hr.Failed) { return hr;