Commits

Aleš Erjavec  committed 8adbcea

Fixed a memory leak when raising an exception.

  • Participants
  • Parent commits 33695ad

Comments (0)

Files changed (1)

File source/orange/liblinear_interface.cpp

 
 
 PClassifier TLinearLearner::operator()(PExampleGenerator examples, const int &weight){
+	PDomain domain = examples->domain;
+
+	if (!domain->classVar) {
+	    raiseError("classVar expected");
+	}
+
+	if (domain->classVar->varType != TValue::INTVAR) {
+	    raiseError("Discrete class expected");
+	}
+
 	parameter *param = new parameter;
 	param->solver_type = solver_type;
 	param->eps = eps;
 	param->weight_label = NULL;
 	param->weight = NULL;
 
-	PDomain domain = examples->domain;
-
-	if (!domain->classVar)
-	    raiseError("classVar expected");
-
-	if (domain->classVar->varType != TValue::INTVAR)
-	    raiseError("Discrete class expected");
-
 	// Shallow copy of examples.
 	PExampleTable train_data = mlnew TExampleTable(examples, /* owns= */ false);