Skip to content
Snippets Groups Projects
Commit cd7d237e authored by Julien Michel's avatar Julien Michel
Browse files

COV: Fixing coverity issue 1266747 (Ressource leak)

parent f004ea85
No related branches found
No related tags found
No related merge requests found
......@@ -30,7 +30,7 @@ public:
protected:
LinearKernelFunctor(const Self& copy)
: Superclass(copy)
: Superclass(copy)
{
*this = copy;
}
......@@ -56,29 +56,33 @@ int svmGenericKernelTest( int itkNotUsed(argc), char *argv[] )
{
try
{
const char * inputFilename = argv[1];
const char * outputFilename = argv[2];
otb::LinearKernelFunctor lFunctor;
struct svm_model* model;
model = svm_load_model(inputFilename, &lFunctor);
if(model == 0)
{
itkGenericExceptionMacro( << "Problem while loading SVM model "
<< std::string(inputFilename) );
}
model->param.kernel_generic->print_parameters();
if(svm_save_model(outputFilename, model)!=0)
const char * inputFilename = argv[1];
const char * outputFilename = argv[2];
otb::LinearKernelFunctor lFunctor;
struct svm_model* model;
model = svm_load_model(inputFilename, &lFunctor);
if(model == 0)
{
itkGenericExceptionMacro( << "Problem while loading SVM model "
<< std::string(inputFilename) );
}
model->param.kernel_generic->print_parameters();
if(svm_save_model(outputFilename, model)!=0)
{
if(model != NULL)
{
itkGenericExceptionMacro( << "Problem while saving SVM model "
<< std::string(outputFilename) );
delete model;
}
if(model != NULL)
{
delete model;
}
itkGenericExceptionMacro( << "Problem while saving SVM model "
<< std::string(outputFilename) );
}
if(model != NULL)
{
delete model;
}
}
catch( itk::ExceptionObject & err )
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment