From 4dfd8696a42399ded0af83b43b573b1e18da632b Mon Sep 17 00:00:00 2001 From: Andrews Cordolino Sobral <andrewssobral@gmail.com> Date: Sun, 31 Jul 2022 15:36:17 +0200 Subject: [PATCH] [important] Fixed memory leak on MultiCue and MultiLayer --- src/algorithms/MultiCue.cpp | 3 +++ src/algorithms/MultiLayer.cpp | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/algorithms/MultiCue.cpp b/src/algorithms/MultiCue.cpp index 54cedb7..5c55ab2 100644 --- a/src/algorithms/MultiCue.cpp +++ b/src/algorithms/MultiCue.cpp @@ -99,6 +99,7 @@ void MultiCue::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &i img_background = cv::Mat::zeros(img_input.size(), img_input.type()); img_foreground = cv::cvarrToMat(result_image, TRUE); cvReleaseImage(&result_image); + cvReleaseImage(&frame); #ifndef MEX_COMPILE_FLAG if (showOutput) @@ -551,6 +552,8 @@ void MultiCue::GaussianFiltering(IplImage* frame, uchar*** aFilteredFrame) { aFilteredFrame[i][j][2] = img->imageData[i*img->widthStep + j * 3 + 2]; } } + + cvReleaseImage(&img); } } diff --git a/src/algorithms/MultiLayer.cpp b/src/algorithms/MultiLayer.cpp index 397b851..2d2c6e6 100644 --- a/src/algorithms/MultiLayer.cpp +++ b/src/algorithms/MultiLayer.cpp @@ -206,8 +206,7 @@ void MultiLayer::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat img_foreground.copyTo(img_output); img_background.copyTo(img_bgmodel); - - //cvReleaseImage(&img); + cvReleaseImage(&img); firstTime = false; frameNumber++; -- GitLab