diff --git a/modules/videoio/src/cap_dshow.cpp b/modules/videoio/src/cap_dshow.cpp index c8c63fcb7..88814c83e 100644 --- a/modules/videoio/src/cap_dshow.cpp +++ b/modules/videoio/src/cap_dshow.cpp @@ -1839,6 +1839,8 @@ bool videoInput::setVideoSettingCamera(int deviceID, long Property, long lValue, hr = VDList[deviceID]->pVideoInputFilter->QueryInterface(IID_IAMCameraControl, (void**)&pIAMCameraControl); if (FAILED(hr)) { DebugPrintOut("Error\n"); + if(VDList[deviceID]->pVideoInputFilter)VDList[deviceID]->pVideoInputFilter->Release(); + if(VDList[deviceID]->pVideoInputFilter)VDList[deviceID]->pVideoInputFilter = NULL; return false; } else @@ -1857,6 +1859,8 @@ bool videoInput::setVideoSettingCamera(int deviceID, long Property, long lValue, pIAMCameraControl->Set(Property, lValue, Flags); } pIAMCameraControl->Release(); + if(VDList[deviceID]->pVideoInputFilter)VDList[deviceID]->pVideoInputFilter->Release(); + if(VDList[deviceID]->pVideoInputFilter)VDList[deviceID]->pVideoInputFilter = NULL; return true; } }