提交 f4415153 编写于 作者: C corley

Fixed a couple of memory leaks in videoInput::getDevice() when multiple...

Fixed a couple of memory leaks in videoInput::getDevice() when multiple devices are present in the system
上级 24acbecd
......@@ -2912,7 +2912,7 @@ HRESULT videoInput::getDevice(IBaseFilter** gottaFilter, int deviceId, WCHAR * w
// Enumerate the monikers.
IMoniker *pMoniker = NULL;
ULONG cFetched;
while ((pEnumCat->Next(1, &pMoniker, &cFetched) == S_OK) && (!done))
while ((!done) && (pEnumCat->Next(1, &pMoniker, &cFetched) == S_OK))
{
if(deviceCounter == deviceId)
{
......@@ -2951,6 +2951,12 @@ HRESULT videoInput::getDevice(IBaseFilter** gottaFilter, int deviceId, WCHAR * w
pMoniker = NULL;
}
}
else
{
// cleaning for the case when this isn't the device we are looking for
pMoniker->Release();
pMoniker = NULL;
}
deviceCounter++;
}
pEnumCat->Release();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册