Signed-off-by: Sven Baars sven.wine@gmail.com --- dlls/strmbase/mediatype.c | 14 +++++++++++--- dlls/strmbase/renderer.c | 1 + 2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/dlls/strmbase/mediatype.c b/dlls/strmbase/mediatype.c index 91c0ddc60a..dd5773f5de 100644 --- a/dlls/strmbase/mediatype.c +++ b/dlls/strmbase/mediatype.c @@ -254,6 +254,7 @@ static HRESULT WINAPI IEnumMediaTypesImpl_Skip(IEnumMediaTypes * iface, ULONG cM static HRESULT WINAPI IEnumMediaTypesImpl_Reset(IEnumMediaTypes * iface) { ULONG i; + HRESULT hr; AM_MEDIA_TYPE amt; IEnumMediaTypesImpl *This = impl_from_IEnumMediaTypes(iface);
@@ -264,14 +265,21 @@ static HRESULT WINAPI IEnumMediaTypesImpl_Reset(IEnumMediaTypes * iface) CoTaskMemFree(This->enumMediaDetails.pMediaTypes);
i = 0; - while (This->enumMediaFunction(This->basePin, i, &amt) == S_OK) i++; + while (This->enumMediaFunction(This->basePin, i, &amt) == S_OK) + { + FreeMediaType(&amt); + i++; + }
This->enumMediaDetails.cMediaTypes = i; This->enumMediaDetails.pMediaTypes = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE) * i); for (i = 0; i < This->enumMediaDetails.cMediaTypes; i++) { - This->enumMediaFunction(This->basePin, i,&amt); - if (FAILED(CopyMediaType(&This->enumMediaDetails.pMediaTypes[i], &amt))) + This->enumMediaFunction(This->basePin, i, &amt); + hr = CopyMediaType(&This->enumMediaDetails.pMediaTypes[i], &amt); + FreeMediaType(&amt); + + if (FAILED(hr)) { while (i--) FreeMediaType(&This->enumMediaDetails.pMediaTypes[i]); diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c index c06661ce73..3d5e4b5e7d 100644 --- a/dlls/strmbase/renderer.c +++ b/dlls/strmbase/renderer.c @@ -346,6 +346,7 @@ HRESULT WINAPI BaseRendererImpl_Receive(BaseRenderer *This, IMediaSample * pSamp { return VFW_E_TYPE_NOT_ACCEPTED; } + DeleteMediaType(pmt); }
This->pMediaSample = pSample;