Commit ef4b5095 for tesseract
commit ef4b5095e9c8ce95b08b8b4d8452e845505dcaa3
Author: Stefan Weil <sw@weilnetz.de>
Date: Sun Aug 9 13:13:25 2026 +0200
Fix CID 1610381 (Resource leak)
Free the allocated DawgPositionVector before the early return in
ContinueDawg when the predecessor is not a dictionary word.
Assisted-by: OpenCode / big-pickle (opencode)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
diff --git a/src/lstm/recodebeam.cpp b/src/lstm/recodebeam.cpp
index cf20cf8d..2bf5d9a2 100644
--- a/src/lstm/recodebeam.cpp
+++ b/src/lstm/recodebeam.cpp
@@ -1118,6 +1118,7 @@ void RecodeBeamSearch::ContinueDawg(int code, int unichar_id, float cert,
dawg_args.active_dawgs = uni_prev->dawgs;
word_start = uni_prev->start_of_dawg;
} else {
+ delete updated_dawgs;
return; // Can't continue if not a dict word.
}
auto permuter = static_cast<PermuterType>(dict_->def_letter_is_okay(