Module: wine Branch: master Commit: 8b67cfb8e446c38361a128449dbd051f9bd7dc2c URL: http://source.winehq.org/git/wine.git/?a=commit;h=8b67cfb8e446c38361a128449d...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Sun Mar 12 12:16:54 2017 +0300
inetcomm/tests: Fix test stream leak (Valgrind).
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alexandre Julliard julliard@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)