Skip to content

Commit 146d2ca

Browse files
committed
Classify: Fix new resource leak (CID 1396163)
This fixes a warnings from Coverity Scan. Signed-off-by: Stefan Weil <[email protected]>
1 parent edbd07a commit 146d2ca

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/classify/adaptmatch.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -1543,7 +1543,10 @@ void Classify::DoAdaptiveMatch(TBLOB *Blob, ADAPT_RESULTS *Results) {
15431543

15441544
// TODO: With LSTM, static_classifier_ is nullptr.
15451545
// Return to avoid crash in CharNormClassifier.
1546-
if (static_classifier_ == nullptr) return;
1546+
if (static_classifier_ == nullptr) {
1547+
delete sample;
1548+
return;
1549+
}
15471550

15481551
if (AdaptedTemplates->NumPermClasses < matcher_permanent_classes_min ||
15491552
tess_cn_matching) {

0 commit comments

Comments
 (0)