Skip to content

Commit 1327551

Browse files
committed
classify/mastertraining: Fix memory leaks
Coverity report: CID 1164739 (#1 of 1): Resource leak (RESOURCE_LEAK) 18. leaked_storage: Variable frag going out of scope leaks the storage it points to. Signed-off-by: Stefan Weil <[email protected]>
1 parent 963b935 commit 1327551

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

classify/mastertrainer.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,7 @@ void MasterTrainer::ReplaceFragmentedSamples() {
877877
if (good_ch != INVALID_UNICHAR_ID)
878878
good_junk[good_ch] = true; // We want this one.
879879
}
880+
delete frag;
880881
}
881882
#endif
882883
// For now just use all the junk that was from natural fragments.
@@ -891,6 +892,7 @@ void MasterTrainer::ReplaceFragmentedSamples() {
891892
junk_samples_.extract_sample(s);
892893
samples_.AddSample(frag_set.id_to_unichar(junk_id), sample);
893894
}
895+
delete frag;
894896
}
895897
junk_samples_.DeleteDeadSamples();
896898
junk_samples_.OrganizeByFontAndClass();

0 commit comments

Comments
 (0)