Commit c7f51d85 authored by Sven Baars's avatar Sven Baars Committed by Alexandre Julliard

strmbase: Fix some memory leaks (Valgrind).

parent cf1b9fe2
...@@ -264,14 +264,17 @@ static HRESULT WINAPI IEnumMediaTypesImpl_Reset(IEnumMediaTypes * iface) ...@@ -264,14 +264,17 @@ static HRESULT WINAPI IEnumMediaTypesImpl_Reset(IEnumMediaTypes * iface)
CoTaskMemFree(This->enumMediaDetails.pMediaTypes); CoTaskMemFree(This->enumMediaDetails.pMediaTypes);
i = 0; 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.cMediaTypes = i;
This->enumMediaDetails.pMediaTypes = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE) * i); This->enumMediaDetails.pMediaTypes = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE) * i);
for (i = 0; i < This->enumMediaDetails.cMediaTypes; i++) for (i = 0; i < This->enumMediaDetails.cMediaTypes; i++)
{ {
This->enumMediaFunction(This->basePin, i,&amt); if (FAILED(This->enumMediaFunction(This->basePin, i, &This->enumMediaDetails.pMediaTypes[i])))
if (FAILED(CopyMediaType(&This->enumMediaDetails.pMediaTypes[i], &amt)))
{ {
while (i--) while (i--)
FreeMediaType(&This->enumMediaDetails.pMediaTypes[i]); FreeMediaType(&This->enumMediaDetails.pMediaTypes[i]);
......
...@@ -346,6 +346,7 @@ HRESULT WINAPI BaseRendererImpl_Receive(BaseRenderer *This, IMediaSample * pSamp ...@@ -346,6 +346,7 @@ HRESULT WINAPI BaseRendererImpl_Receive(BaseRenderer *This, IMediaSample * pSamp
{ {
return VFW_E_TYPE_NOT_ACCEPTED; return VFW_E_TYPE_NOT_ACCEPTED;
} }
DeleteMediaType(pmt);
} }
This->pMediaSample = pSample; This->pMediaSample = pSample;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment