Commit 45bd38ec authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Alexandre Julliard

quartz: Fix some memory leaks in the file source.

parent d56c50c8
...@@ -432,6 +432,8 @@ static ULONG WINAPI AsyncReader_Release(IBaseFilter * iface) ...@@ -432,6 +432,8 @@ static ULONG WINAPI AsyncReader_Release(IBaseFilter * iface)
This->csFilter.DebugInfo->Spare[0] = 0; This->csFilter.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->csFilter); DeleteCriticalSection(&This->csFilter);
This->lpVtbl = NULL; This->lpVtbl = NULL;
CoTaskMemFree(This->pszFileName);
FreeMediaType(This->pmt);
CoTaskMemFree(This); CoTaskMemFree(This);
return 0; return 0;
} }
...@@ -639,8 +641,13 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi ...@@ -639,8 +641,13 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi
/* store file name & media type */ /* store file name & media type */
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
CoTaskMemFree(This->pszFileName);
if (This->pmt)
FreeMediaType(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);
This->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); This->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
if (!pmt) if (!pmt)
{ {
...@@ -674,7 +681,9 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi ...@@ -674,7 +681,9 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi
} }
CoTaskMemFree(This->pszFileName); CoTaskMemFree(This->pszFileName);
FreeMediaType(This->pmt);
This->pszFileName = NULL; This->pszFileName = NULL;
This->pmt = NULL;
CloseHandle(hFile); CloseHandle(hFile);
} }
......
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