Skip to content

Commit 1e60a8d

Browse files
committed
Fix crash caused by undefined value of local variable
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 <[email protected]>
1 parent f8bc09a commit 1e60a8d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

classify/adaptmatch.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -818,14 +818,14 @@ int Classify::GetAdaptiveFeatures(TBLOB *Blob,
818818
classify_norm_method.set_value(baseline);
819819
Features = ExtractPicoFeatures(Blob);
820820

821+
*FloatFeatures = Features;
822+
821823
NumFeatures = Features->NumFeatures;
822824
if (NumFeatures > UNLIKELY_NUM_FEAT) {
823-
FreeFeatureSet(Features);
824825
return 0;
825826
}
826827

827828
ComputeIntFeatures(Features, IntFeatures);
828-
*FloatFeatures = Features;
829829

830830
return NumFeatures;
831831
} /* GetAdaptiveFeatures */

0 commit comments

Comments
 (0)