mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-18 11:28:51 +08:00
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:
parent
5919916bc5
commit
c4dbc0e0fd
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user