From 64c018507b013ca6117e5f664c630b81531807fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20St=C3=BCdemann?= Date: Thu, 3 Jun 2021 22:12:46 +0200 Subject: [PATCH] videoio(dshow) fix memory leak --- modules/videoio/src/cap_dshow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/videoio/src/cap_dshow.cpp b/modules/videoio/src/cap_dshow.cpp index cf653f61a7..94837e7ab2 100644 --- a/modules/videoio/src/cap_dshow.cpp +++ b/modules/videoio/src/cap_dshow.cpp @@ -2496,7 +2496,10 @@ static void findClosestSizeAndSubtype(videoDevice * VD, int widthIn, int heightI int tempH = 999999; //Don't want to get stuck in a loop - if(stepX < 1 || stepY < 1) continue; + if(stepX < 1 || stepY < 1){ + MyDeleteMediaType(pmtConfig); + continue; + } //DebugPrintOut("min is %i %i max is %i %i - res is %i %i\n", scc.MinOutputSize.cx, scc.MinOutputSize.cy, scc.MaxOutputSize.cx, scc.MaxOutputSize.cy, stepX, stepY); //DebugPrintOut("min frame duration is %i max duration is %i\n", scc.MinFrameInterval, scc.MaxFrameInterval);