Skip to content

Commit

Permalink
api/baseapi: Fix memory leaks at program termination
Browse files Browse the repository at this point in the history
Calling TessBaseAPI::Clear() which calls TessBaseAPI::ClearResults()
which calls SavePixForCrash(0, NULL) is needed to release objects
allocated in global_crash_pixes.

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Oct 25, 2016
1 parent 6fad5fc commit ea786e2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions api/baseapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1924,11 +1924,11 @@ char* TessBaseAPI::GetOsdText(int page_number) {
int script_id = osr.get_best_script(orient_id);
float orient_conf = osr.best_result.oconfidence;
float script_conf = osr.best_result.sconfidence;
const char* script_name =
const char* script_name =
osr.unicharset->get_script_from_script_id(script_id);

// clockwise orientation of the input image, in degrees
int orient_deg = orient_id * 90;
int orient_deg = orient_id * 90;

// clockwise rotation needed to make the page upright
int rotate = OrientationIdToValue(orient_id);
Expand Down Expand Up @@ -2073,6 +2073,7 @@ void TessBaseAPI::Clear() {
* other than Init and anything declared above it in the class definition.
*/
void TessBaseAPI::End() {
Clear();
if (thresholder_ != NULL) {
delete thresholder_;
thresholder_ = NULL;
Expand Down

0 comments on commit ea786e2

Please sign in to comment.