From 05f319a39477ff675f14cd9ed6765ce3a5900e11 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 8 Jun 2020 18:59:41 -0500 Subject: [PATCH] strmbase: Release the allocator in IPin::Disconnect() (Valgrind). Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/quartz/tests/videorenderer.c | 2 +- dlls/quartz/tests/vmr9.c | 2 +- dlls/strmbase/pin.c | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/dlls/quartz/tests/videorenderer.c b/dlls/quartz/tests/videorenderer.c index 7330859466e..d603ea46edd 100644 --- a/dlls/quartz/tests/videorenderer.c +++ b/dlls/quartz/tests/videorenderer.c @@ -1443,7 +1443,7 @@ static void test_connect_pin(void) ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr); ref = IMemAllocator_Release(allocator); - todo_wine ok(!ref, "Got outstanding refcount %d.\n", ref); + ok(!ref, "Got outstanding refcount %d.\n", ref); IMemInputPin_Release(input); IPin_Release(pin); ref = IFilterGraph2_Release(graph); diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c index 7dd6dbe1dd2..14b6539a6bd 100644 --- a/dlls/quartz/tests/vmr9.c +++ b/dlls/quartz/tests/vmr9.c @@ -3072,7 +3072,7 @@ static void test_renderless_formats(void) ok(hr == S_OK, "Test %u: Got hr %#x.\n", i, hr); hr = IMemInputPin_GetAllocator(input, &allocator); - todo_wine_if (i == 0) ok(hr == S_OK, "Test %u: Got hr %#x.\n", i, hr); + todo_wine ok(hr == S_OK, "Test %u: Got hr %#x.\n", i, hr); if (hr != S_OK) { test_allocator(input); diff --git a/dlls/strmbase/pin.c b/dlls/strmbase/pin.c index f08c6d01865..e5017c2ff98 100644 --- a/dlls/strmbase/pin.c +++ b/dlls/strmbase/pin.c @@ -594,6 +594,13 @@ static HRESULT WINAPI source_Disconnect(IPin *iface) IMemInputPin_Release(This->pMemInputPin); This->pMemInputPin = NULL; } + + if (This->pAllocator) + { + IMemAllocator_Release(This->pAllocator); + This->pAllocator = NULL; + } + if (This->pin.peer) { IPin_Release(This->pin.peer); @@ -930,6 +937,12 @@ static HRESULT WINAPI sink_Disconnect(IPin *iface) if (pin->pFuncsTable->sink_disconnect) pin->pFuncsTable->sink_disconnect(pin); + if (pin->pAllocator) + { + IMemAllocator_Release(pin->pAllocator); + pin->pAllocator = NULL; + } + IPin_Release(pin->pin.peer); pin->pin.peer = NULL; FreeMediaType(&pin->pin.mt);