From 56659c3a7035365f83289caa137b3073c4b252b9 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 6 Apr 2010 20:05:15 +0200 Subject: [PATCH] quartz: Don't return a pointer to a stack variable in AMFilterData_ParseFilterData(). --- dlls/dxdiagn/provider.c | 9 +++------ dlls/quartz/filtermapper.c | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/dlls/dxdiagn/provider.c b/dlls/dxdiagn/provider.c index 6075c9dc791..65efadd1ee2 100644 --- a/dlls/dxdiagn/provider.c +++ b/dlls/dxdiagn/provider.c @@ -689,8 +689,7 @@ static HRESULT DXDiag_InitDXDiagDirectShowFiltersContainer(IDxDiagContainer* pSu SUCCEEDED(IFilterMapper2_QueryInterface(pFileMapper, &IID_IAMFilterData, (void **)&pFilterData))) { DWORD array_size; - BYTE *tmp; - REGFILTER2 *pRF = NULL; + REGFILTER2 *pRF; if (SUCCEEDED(IPropertyBag_Read(pPropFilterBag, wszFilterDataName, &v, NULL)) && SUCCEEDED(SafeArrayAccessData(V_UNION(&v, parray), (LPVOID*) &pData))) @@ -698,10 +697,8 @@ static HRESULT DXDiag_InitDXDiagDirectShowFiltersContainer(IDxDiagContainer* pSu ULONG j; array_size = V_UNION(&v, parray)->rgsabound->cElements; - if (SUCCEEDED(IAMFilterData_ParseFilterData(pFilterData, pData, array_size, &tmp))) + if (SUCCEEDED(IAMFilterData_ParseFilterData(pFilterData, pData, array_size, (BYTE **)&pRF))) { - pRF = ((REGFILTER2 **)tmp)[0]; - snprintfW(bufferW, sizeof(bufferW)/sizeof(bufferW[0]), szVersionFormat, pRF->dwVersion); if (pRF->dwVersion == 1) { @@ -721,7 +718,7 @@ static HRESULT DXDiag_InitDXDiagDirectShowFiltersContainer(IDxDiagContainer* pSu } dwMerit = pRF->dwMerit; - CoTaskMemFree(tmp); + CoTaskMemFree(pRF); } SafeArrayUnaccessData(V_UNION(&v, parray)); diff --git a/dlls/quartz/filtermapper.c b/dlls/quartz/filtermapper.c index bacb72950d6..aeacfac386e 100644 --- a/dlls/quartz/filtermapper.c +++ b/dlls/quartz/filtermapper.c @@ -1778,7 +1778,7 @@ static HRESULT WINAPI AMFilterData_ParseFilterData(IAMFilterData* iface, prf2 = CoTaskMemAlloc(sizeof(*prf2)); if (!prf2) return E_OUTOFMEMORY; - *ppRegFilter2 = (BYTE *)&prf2; + *ppRegFilter2 = (BYTE *)prf2; hr = FM2_ReadFilterData(pData, prf2); if (FAILED(hr))