From 8b67cfb8e446c38361a128449dbd051f9bd7dc2c Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sun, 12 Mar 2017 12:16:54 +0300 Subject: [PATCH] inetcomm/tests: Fix test stream leak (Valgrind). Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- 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)