Fix crash caused by undefined value of local variable

Commit b1f03cb697 added a call of function
FreeFeatureSet to fix a memory leak, but introduced a new bug because the
local variable FloatFeatures was not always assigned a value.

Now FloatFeatures is always assigned a value, and we only need a single
place where FreeFeatureSet is called.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2016-11-07 12:31:20 +01:00 committed by Zdenko Podobný
parent 5919916bc5
commit c4dbc0e0fd

View File

@ -818,14 +818,14 @@ int Classify::GetAdaptiveFeatures(TBLOB *Blob,
classify_norm_method.set_value(baseline);
Features = ExtractPicoFeatures(Blob);
*FloatFeatures = Features;
NumFeatures = Features->NumFeatures;
if (NumFeatures > UNLIKELY_NUM_FEAT) {
FreeFeatureSet(Features);
return 0;
}
ComputeIntFeatures(Features, IntFeatures);
*FloatFeatures = Features;
return NumFeatures;
} /* GetAdaptiveFeatures */