Skip to content

Commit 9f87c36

Browse files
committed
Fix duplicate fclose
Coverity bug report: CID 1270401 (#1 of 1): Use after free As the comment (which was also fixed) says, ReadNextBox() already calls fclose(box_file), so don't call it a 2nd time. Signed-off-by: Stefan Weil <[email protected]>
1 parent 62ae99c commit 9f87c36

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

ccmain/recogtraining.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void Tesseract::recog_training_segmented(const STRING &fname,
8484
const char *lastdot = strrchr(box_fname.string(), '.');
8585
if (lastdot != NULL) box_fname[lastdot - box_fname.string()] = '\0';
8686
box_fname += ".box";
87-
// read_next_box() will close box_file
87+
// ReadNextBox() will close box_file
8888
FILE *box_file = open_file(box_fname.string(), "r");
8989

9090
PAGE_RES_IT page_res_it;
@@ -132,7 +132,6 @@ void Tesseract::recog_training_segmented(const STRING &fname,
132132
}
133133
page_res_it.forward();
134134
} while (keep_going);
135-
fclose(box_file);
136135

137136
// Set up scripts on all of the words that did not get sent to
138137
// ambigs_classify_and_output. They all should have, but if all the

0 commit comments

Comments
 (0)