Commit f4415153 authored by corley's avatar corley

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

Fixed a couple of memory leaks in videoInput::getDevice() when multiple devices are present in the system
parent 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% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment