Skip to content

Commit b1f03cb

Browse files
committed
classify/adaptmatch: Fix memory leak
Coverity report: CID 1340280 (#1 of 1): Resource leak (RESOURCE_LEAK) 7. leaked_storage: Variable FloatFeatures going out of scope leaks the storage it points to. Signed-off-by: Stefan Weil <[email protected]>
1 parent a351dae commit b1f03cb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

classify/adaptmatch.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -907,8 +907,10 @@ void Classify::AdaptToChar(TBLOB* Blob, CLASS_ID ClassId, int FontinfoId,
907907
IClass = ClassForClassId(adaptive_templates->Templates, ClassId);
908908

909909
NumFeatures = GetAdaptiveFeatures(Blob, IntFeatures, &FloatFeatures);
910-
if (NumFeatures <= 0)
910+
if (NumFeatures <= 0) {
911+
FreeFeatureSet(FloatFeatures);
911912
return;
913+
}
912914

913915
// Only match configs with the matching font.
914916
BIT_VECTOR MatchingFontConfigs = NewBitVector(MAX_NUM_PROTOS);

0 commit comments

Comments
 (0)