quartz: Fix some memory leaks (Valgrind).

Signed-off-by: Sven Baars <sven.wine@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Sven Baars 2018-12-22 15:47:22 +01:00 committed by Alexandre Julliard
parent ab445900dd
commit 889fe31483
3 changed files with 11 additions and 4 deletions

View File

@ -493,7 +493,7 @@ static ULONG WINAPI AsyncReader_Release(IBaseFilter * iface)
} }
CoTaskMemFree(This->pszFileName); CoTaskMemFree(This->pszFileName);
if (This->pmt) if (This->pmt)
FreeMediaType(This->pmt); DeleteMediaType(This->pmt);
BaseFilter_Destroy(&This->filter); BaseFilter_Destroy(&This->filter);
CoTaskMemFree(This); CoTaskMemFree(This);
return 0; return 0;
@ -610,7 +610,7 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi
{ {
CoTaskMemFree(This->pszFileName); CoTaskMemFree(This->pszFileName);
if (This->pmt) if (This->pmt)
FreeMediaType(This->pmt); DeleteMediaType(This->pmt);
This->pszFileName = CoTaskMemAlloc((strlenW(pszFileName) + 1) * sizeof(WCHAR)); This->pszFileName = CoTaskMemAlloc((strlenW(pszFileName) + 1) * sizeof(WCHAR));
strcpyW(This->pszFileName, pszFileName); strcpyW(This->pszFileName, pszFileName);
@ -650,7 +650,7 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi
CoTaskMemFree(This->pszFileName); CoTaskMemFree(This->pszFileName);
if (This->pmt) if (This->pmt)
FreeMediaType(This->pmt); DeleteMediaType(This->pmt);
This->pszFileName = NULL; This->pszFileName = NULL;
This->pmt = NULL; This->pmt = NULL;

View File

@ -687,6 +687,7 @@ static HRESULT WINAPI FilterGraph2_RemoveFilter(IFilterGraph2 *iface, IBaseFilte
IBaseFilter_SetSyncSource(pFilter, NULL); IBaseFilter_SetSyncSource(pFilter, NULL);
IBaseFilter_Release(pFilter); IBaseFilter_Release(pFilter);
list_remove(&entry->entry); list_remove(&entry->entry);
CoTaskMemFree(entry->name);
heap_free(entry); heap_free(entry);
This->version++; This->version++;
/* Invalidate interfaces in the cache */ /* 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("MajorType %s\n", debugstr_guid(&mt.majortype));
TRACE("SubType %s\n", debugstr_guid(&mt.subtype)); TRACE("SubType %s\n", debugstr_guid(&mt.subtype));
CoTaskMemFree(filename);
FreeMediaType(&mt);
if (ppFilter) if (ppFilter)
*ppFilter = preader; *ppFilter = preader;
IFileSourceFilter_Release(pfile); IFileSourceFilter_Release(pfile);

View File

@ -444,6 +444,9 @@ static HRESULT StdMediaSample2_Construct(BYTE * pbBuffer, LONG cbBuffer, IMemAll
static void StdMediaSample2_Delete(StdMediaSample2 * This) 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 */ /* NOTE: does not remove itself from the list it belongs to */
CoTaskMemFree(This); CoTaskMemFree(This);
} }
@ -676,7 +679,7 @@ static HRESULT WINAPI StdMediaSample2_SetMediaType(IMediaSample2 * iface, AM_MED
if (This->props.pMediaType) if (This->props.pMediaType)
{ {
FreeMediaType(This->props.pMediaType); DeleteMediaType(This->props.pMediaType);
This->props.pMediaType = NULL; This->props.pMediaType = NULL;
} }
if (!pMediaType) if (!pMediaType)