[PATCH] inetcomm/tests: Fix test stream leak (Valgrind)

Nikolay Sivov nsivov at codeweavers.com
Sun Mar 12 04:16:54 CDT 2017


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/inetcomm/tests/mimeole.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/dlls/inetcomm/tests/mimeole.c b/dlls/inetcomm/tests/mimeole.c
index c2026bc1cf..956a5b763f 100644
--- a/dlls/inetcomm/tests/mimeole.c
+++ b/dlls/inetcomm/tests/mimeole.c
@@ -323,7 +323,12 @@ static ULONG WINAPI Stream_AddRef(IStream *iface)
 static ULONG WINAPI Stream_Release(IStream *iface)
 {
     TestStream *This = impl_from_IStream(iface);
-    return InterlockedDecrement(&This->ref);
+    ULONG ref = InterlockedDecrement(&This->ref);
+
+    if (!ref)
+        HeapFree(GetProcessHeap(), 0, This);
+
+    return ref;
 }
 
 static HRESULT WINAPI Stream_Read(IStream *iface, void *pv, ULONG cb, ULONG *pcbRead)
-- 
2.11.0




More information about the wine-patches mailing list