Skip to content

Commit

Permalink
Fix crash caused by undefined value of local variable
Browse files Browse the repository at this point in the history
Commit b1f03cb 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>
  • Loading branch information
stweil committed Nov 7, 2016
1 parent f8bc09a commit 1e60a8d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions classify/adaptmatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 1e60a8d

Please sign in to comment.