[opencv] 03/33: fixed memory leaks in cvtyuv tests

Mattia Rizzolo mattia at debian.org
Tue Oct 4 17:51:02 UTC 2016


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to annotated tag 2.4.12.2
in repository opencv.

commit bf94e6a91cea3bc4742aa04308855b4cbd0bed27
Author: Ilya Lavrenov <ilya.lavrenov at itseez.com>
Date:   Sat Aug 15 10:06:09 2015 +0300

    fixed memory leaks in cvtyuv tests
    
    (cherry picked from commit b2489d31d66599ac2aaa79af2b753a24649776aa)
---
 modules/imgproc/test/test_cvtyuv.cpp | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/modules/imgproc/test/test_cvtyuv.cpp b/modules/imgproc/test/test_cvtyuv.cpp
index 0cce64c..7407523 100644
--- a/modules/imgproc/test/test_cvtyuv.cpp
+++ b/modules/imgproc/test/test_cvtyuv.cpp
@@ -548,7 +548,7 @@ void referenceRGB2YUV(const Mat& rgb, Mat& yuv, RGBreader* rgbReader, YUVwriter*
 
 struct ConversionYUV
 {
-    ConversionYUV( const int code )
+    explicit ConversionYUV( const int code )
     {
         yuvReader_  = YUVreader :: getReader(code);
         yuvWriter_  = YUVwriter :: getWriter(code);
@@ -557,6 +557,24 @@ struct ConversionYUV
         grayWriter_ = GRAYwriter:: getWriter(code);
     }
 
+    ~ConversionYUV()
+    {
+        if (yuvReader_)
+            delete yuvReader_;
+
+        if (yuvWriter_)
+            delete yuvWriter_;
+
+        if (rgbReader_)
+            delete rgbReader_;
+
+        if (rgbReader_)
+            delete rgbReader_;
+
+        if (grayWriter_)
+            delete grayWriter_;
+    }
+
     int getDcn()
     {
         return (rgbWriter_ != 0) ? rgbWriter_->channels() : ((grayWriter_ != 0) ? grayWriter_->channels() : yuvWriter_->channels());

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opencv.git



More information about the debian-science-commits mailing list