Skip to content

Commit d7240d1

Browse files
committed
fix leaking handle in cap_dshow.cpp
1 parent 776c8c5 commit d7240d1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

modules/videoio/src/cap_dshow.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -877,14 +877,12 @@ void videoDevice::NukeDownstream(IBaseFilter *pBF){
877877

878878
void videoDevice::destroyGraph(){
879879
HRESULT hr = 0;
880-
//int FuncRetval=0;
881-
//int NumFilters=0;
882880

883881
int i = 0;
884882
while (hr == NOERROR)
885883
{
886884
IEnumFilters * pEnum = 0;
887-
ULONG cFetched;
885+
ULONG cFetched = 0;
888886

889887
// We must get the enumerator again every time because removing a filter from the graph
890888
// invalidates the enumerator. We always get only the first filter from each enumerator.
@@ -917,9 +915,11 @@ void videoDevice::destroyGraph(){
917915
pFilter->Release();
918916
pFilter = NULL;
919917
}
920-
else break;
921918
pEnum->Release();
922919
pEnum = NULL;
920+
921+
if (cFetched == 0)
922+
break;
923923
i++;
924924
}
925925

0 commit comments

Comments
 (0)