Module: wine Branch: master Commit: 33b2f69c9fef56107665bb4ae0e915b2dcd8df13 URL: http://source.winehq.org/git/wine.git/?a=commit;h=33b2f69c9fef56107665bb4ae0...
Author: Maarten Lankhorst m.b.lankhorst@gmail.com Date: Thu Apr 17 13:11:05 2008 -0700
quartz: Fix sample leak in file source on failure path.
---
dlls/quartz/filesource.c | 24 +++++++++++------------- 1 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c index d31e150..8704b50 100644 --- a/dlls/quartz/filesource.c +++ b/dlls/quartz/filesource.c @@ -1125,30 +1125,28 @@ static HRESULT WINAPI FileAsyncReader_WaitForNext(IAsyncReader * iface, DWORD dw LeaveCriticalSection(&This->csList); }
- if (SUCCEEDED(hr) && !This->bFlushing) + if (SUCCEEDED(hr)) { /* 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()); - }
- if (SUCCEEDED(hr)) - { - IMediaSample_SetActualDataLength(pDataRq->pSample, dwBytes); + /* Return the sample no matter what so it can be destroyed */ *ppSample = pDataRq->pSample; *pdwUser = pDataRq->dwUserData; + + if (This->bFlushing) + { + hr = VFW_E_WRONG_STATE; + 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);
- /* Return the sample if flushing so it can be destroyed */ - if (This->bFlushing && SUCCEEDED(hr)) - { - hr = VFW_E_WRONG_STATE; - IMediaSample_SetActualDataLength(pDataRq->pSample, 0); - } - TRACE("-- %x\n", hr); return hr; }