qcap: Fixed a use after free in error path (Coverity).

This commit is contained in:
Marcus Meissner 2012-08-17 23:04:31 +02:00 committed by Alexandre Julliard
parent de7635a2f0
commit 524ff6fe27
2 changed files with 5 additions and 3 deletions

View File

@ -314,6 +314,7 @@ HRESULT qcap_driver_get_format(const Capture *capBox, AM_MEDIA_TYPE ** mT)
if (!vi)
{
CoTaskMemFree(mT[0]);
mT[0] = NULL;
return E_OUTOFMEMORY;
}
mT[0]->majortype = MEDIATYPE_Video;

View File

@ -678,9 +678,10 @@ static HRESULT WINAPI VfwPin_GetMediaType(BasePin *iface, int iPosition, AM_MEDI
return VFW_S_NO_MORE_ITEMS;
hr = qcap_driver_get_format(This->driver_info, &vfw_pmt);
CopyMediaType(pmt, vfw_pmt);
DeleteMediaType(vfw_pmt);
if (SUCCEEDED(hr)) {
CopyMediaType(pmt, vfw_pmt);
DeleteMediaType(vfw_pmt);
}
return hr;
}