Nikolay Sivov : inetcomm/tests: Fix test stream leak (Valgrind).

Alexandre Julliard julliard at winehq.org
Mon Mar 13 15:40:32 CDT 2017


Module: wine
Branch: master
Commit: 8b67cfb8e446c38361a128449dbd051f9bd7dc2c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8b67cfb8e446c38361a128449dbd051f9bd7dc2c

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sun Mar 12 12:16:54 2017 +0300

inetcomm/tests: Fix test stream leak (Valgrind).

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 c2026bc..956a5b7 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)




More information about the wine-cvs mailing list