Commit 33b2f69c authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Alexandre Julliard

quartz: Fix sample leak in file source on failure path.

parent 119d7caf
...@@ -1125,30 +1125,28 @@ static HRESULT WINAPI FileAsyncReader_WaitForNext(IAsyncReader * iface, DWORD dw ...@@ -1125,30 +1125,28 @@ static HRESULT WINAPI FileAsyncReader_WaitForNext(IAsyncReader * iface, DWORD dw
LeaveCriticalSection(&This->csList); LeaveCriticalSection(&This->csList);
} }
if (SUCCEEDED(hr) && !This->bFlushing) if (SUCCEEDED(hr))
{ {
/* get any errors */ /* get any errors */
if (!GetOverlappedResult(This->hFile, &pDataRq->ovl, &dwBytes, FALSE)) if (!This->bFlushing && !GetOverlappedResult(This->hFile, &pDataRq->ovl, &dwBytes, FALSE))
hr = HRESULT_FROM_WIN32(GetLastError()); hr = HRESULT_FROM_WIN32(GetLastError());
}
if (SUCCEEDED(hr)) /* Return the sample no matter what so it can be destroyed */
{
IMediaSample_SetActualDataLength(pDataRq->pSample, dwBytes);
*ppSample = pDataRq->pSample; *ppSample = pDataRq->pSample;
*pdwUser = pDataRq->dwUserData; *pdwUser = pDataRq->dwUserData;
}
/* no need to close event handle since we will close it when the pin is destroyed */
CoTaskMemFree(pDataRq);
/* Return the sample if flushing so it can be destroyed */ if (This->bFlushing)
if (This->bFlushing && SUCCEEDED(hr))
{ {
hr = VFW_E_WRONG_STATE; hr = VFW_E_WRONG_STATE;
IMediaSample_SetActualDataLength(pDataRq->pSample, 0); dwBytes = 0;
}
IMediaSample_SetActualDataLength(pDataRq->pSample, dwBytes);
} }
/* no need to close event handle since we will close it when the pin is destroyed */
CoTaskMemFree(pDataRq);
TRACE("-- %x\n", hr); TRACE("-- %x\n", hr);
return hr; return hr;
} }
......
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