[opencv] 21/33: release filestorage before exception

Mattia Rizzolo mattia at debian.org
Tue Oct 4 17:51:05 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 3c3bc123fc8508e1845d0a3e1ea85f66b1a36fc9
Author: Ilya Lavrenov <ilya.lavrenov at itseez.com>
Date:   Tue Sep 1 13:04:33 2015 +0300

    release filestorage before exception
    
    (cherry picked from commit 3a1bb933401446b442348026b9cb680d35f3f449)
---
 modules/ml/src/svm.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/ml/src/svm.cpp b/modules/ml/src/svm.cpp
index 0a5bfff..594a43a 100644
--- a/modules/ml/src/svm.cpp
+++ b/modules/ml/src/svm.cpp
@@ -2315,7 +2315,12 @@ void CvSVM::write( CvFileStorage* fs, const char* name ) const
                       params.svm_type == CvSVM::ONE_CLASS ? 1 : 0;
     const CvSVMDecisionFunc* df = decision_func;
     if( !isSvmModelApplicable(sv_total, var_all, var_count, class_count) )
+    {
+        cvReleaseFileStorage( &fs );
+        fs = NULL;
+
         CV_ERROR( CV_StsParseError, "SVM model data is invalid, check sv_count, var_* and class_count tags" );
+    }
 
     cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_ML_SVM );
 

-- 
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