Signed-off-by: Sven Baars sven.wine@gmail.com --- dlls/quartz/filesource.c | 6 +++--- dlls/quartz/filtergraph.c | 4 ++++ dlls/quartz/memallocator.c | 5 ++++- 3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c index e5904dc876..df444ae40d 100644 --- a/dlls/quartz/filesource.c +++ b/dlls/quartz/filesource.c @@ -493,7 +493,7 @@ static ULONG WINAPI AsyncReader_Release(IBaseFilter * iface) } CoTaskMemFree(This->pszFileName); if (This->pmt) - FreeMediaType(This->pmt); + DeleteMediaType(This->pmt); BaseFilter_Destroy(&This->filter); CoTaskMemFree(This); return 0; @@ -610,7 +610,7 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi { CoTaskMemFree(This->pszFileName); if (This->pmt) - FreeMediaType(This->pmt); + DeleteMediaType(This->pmt);
This->pszFileName = CoTaskMemAlloc((strlenW(pszFileName) + 1) * sizeof(WCHAR)); strcpyW(This->pszFileName, pszFileName); @@ -650,7 +650,7 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi
CoTaskMemFree(This->pszFileName); if (This->pmt) - FreeMediaType(This->pmt); + DeleteMediaType(This->pmt); This->pszFileName = NULL; This->pmt = NULL;
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 7abffa5045..02707b4a5d 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -687,6 +687,7 @@ static HRESULT WINAPI FilterGraph2_RemoveFilter(IFilterGraph2 *iface, IBaseFilte IBaseFilter_SetSyncSource(pFilter, NULL); IBaseFilter_Release(pFilter); list_remove(&entry->entry); + CoTaskMemFree(entry->name); heap_free(entry); This->version++; /* Invalidate interfaces in the cache */ @@ -1801,6 +1802,9 @@ static HRESULT WINAPI FilterGraph2_AddSourceFilter(IFilterGraph2 *iface, LPCWSTR TRACE("MajorType %s\n", debugstr_guid(&mt.majortype)); TRACE("SubType %s\n", debugstr_guid(&mt.subtype));
+ CoTaskMemFree(filename); + FreeMediaType(&mt); + if (ppFilter) *ppFilter = preader; IFileSourceFilter_Release(pfile); diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c index f5ee3c29ef..477c63ae05 100644 --- a/dlls/quartz/memallocator.c +++ b/dlls/quartz/memallocator.c @@ -444,6 +444,9 @@ static HRESULT StdMediaSample2_Construct(BYTE * pbBuffer, LONG cbBuffer, IMemAll
static void StdMediaSample2_Delete(StdMediaSample2 * This) { + if (This->props.pMediaType) + DeleteMediaType(This->props.pMediaType); + /* NOTE: does not remove itself from the list it belongs to */ CoTaskMemFree(This); } @@ -676,7 +679,7 @@ static HRESULT WINAPI StdMediaSample2_SetMediaType(IMediaSample2 * iface, AM_MED
if (This->props.pMediaType) { - FreeMediaType(This->props.pMediaType); + DeleteMediaType(This->props.pMediaType); This->props.pMediaType = NULL; } if (!pMediaType)
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;