quartz: Don't return a pointer to a stack variable in AMFilterData_ParseFilterData().

This commit is contained in:
Henri Verbeet 2010-04-06 20:05:15 +02:00 committed by Alexandre Julliard
parent e11f637c57
commit 56659c3a70
2 changed files with 4 additions and 7 deletions

View File

@ -689,8 +689,7 @@ static HRESULT DXDiag_InitDXDiagDirectShowFiltersContainer(IDxDiagContainer* pSu
SUCCEEDED(IFilterMapper2_QueryInterface(pFileMapper, &IID_IAMFilterData, (void **)&pFilterData))) SUCCEEDED(IFilterMapper2_QueryInterface(pFileMapper, &IID_IAMFilterData, (void **)&pFilterData)))
{ {
DWORD array_size; DWORD array_size;
BYTE *tmp; REGFILTER2 *pRF;
REGFILTER2 *pRF = NULL;
if (SUCCEEDED(IPropertyBag_Read(pPropFilterBag, wszFilterDataName, &v, NULL)) && if (SUCCEEDED(IPropertyBag_Read(pPropFilterBag, wszFilterDataName, &v, NULL)) &&
SUCCEEDED(SafeArrayAccessData(V_UNION(&v, parray), (LPVOID*) &pData))) SUCCEEDED(SafeArrayAccessData(V_UNION(&v, parray), (LPVOID*) &pData)))
@ -698,10 +697,8 @@ static HRESULT DXDiag_InitDXDiagDirectShowFiltersContainer(IDxDiagContainer* pSu
ULONG j; ULONG j;
array_size = V_UNION(&v, parray)->rgsabound->cElements; 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); snprintfW(bufferW, sizeof(bufferW)/sizeof(bufferW[0]), szVersionFormat, pRF->dwVersion);
if (pRF->dwVersion == 1) if (pRF->dwVersion == 1)
{ {
@ -721,7 +718,7 @@ static HRESULT DXDiag_InitDXDiagDirectShowFiltersContainer(IDxDiagContainer* pSu
} }
dwMerit = pRF->dwMerit; dwMerit = pRF->dwMerit;
CoTaskMemFree(tmp); CoTaskMemFree(pRF);
} }
SafeArrayUnaccessData(V_UNION(&v, parray)); SafeArrayUnaccessData(V_UNION(&v, parray));

View File

@ -1778,7 +1778,7 @@ static HRESULT WINAPI AMFilterData_ParseFilterData(IAMFilterData* iface,
prf2 = CoTaskMemAlloc(sizeof(*prf2)); prf2 = CoTaskMemAlloc(sizeof(*prf2));
if (!prf2) if (!prf2)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
*ppRegFilter2 = (BYTE *)&prf2; *ppRegFilter2 = (BYTE *)prf2;
hr = FM2_ReadFilterData(pData, prf2); hr = FM2_ReadFilterData(pData, prf2);
if (FAILED(hr)) if (FAILED(hr))