mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
release filestorage before exception
This commit is contained in:
parent
94cf5430d0
commit
3a1bb93340
@ -2315,7 +2315,12 @@ void CvSVM::write( CvFileStorage* fs, const char* name ) const
|
|||||||
params.svm_type == CvSVM::ONE_CLASS ? 1 : 0;
|
params.svm_type == CvSVM::ONE_CLASS ? 1 : 0;
|
||||||
const CvSVMDecisionFunc* df = decision_func;
|
const CvSVMDecisionFunc* df = decision_func;
|
||||||
if( !isSvmModelApplicable(sv_total, var_all, var_count, class_count) )
|
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" );
|
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 );
|
cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_ML_SVM );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user