Skip to content

Commit 036c72c

Browse files
committed
Fix CID 1164733 (Resource leak)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
1 parent 3ea9cff commit 036c72c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/ccmain/pgedit.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,8 @@ bool Tesseract::process_cmd_win_event( // UI command semantics
417417
break;
418418
}
419419

420+
char* parameter;
421+
420422
switch (cmd_event) {
421423
case NULL_CMD_EVENT:
422424
break;
@@ -432,7 +434,9 @@ bool Tesseract::process_cmd_win_event( // UI command semantics
432434
break;
433435
case DEBUG_WERD_CMD_EVENT:
434436
mode = DEBUG_WERD_CMD_EVENT;
435-
word_config_ = image_win->ShowInputDialog("Config File Name");
437+
parameter = image_win->ShowInputDialog("Config File Name");
438+
word_config_ = parameter;
439+
delete[] parameter;
436440
break;
437441
case BOUNDING_BOX_CMD_EVENT:
438442
if (new_value[0] == 'T')
@@ -762,7 +766,6 @@ bool Tesseract::word_display(PAGE_RES_IT* pr_it) {
762766
int word_height; // ht of word BB
763767
bool displayed_something = false;
764768
float shift; // from bot left
765-
C_BLOB_IT c_it; // cblob iterator
766769

767770
if (color_mode != CM_RAINBOW && word_res->box_word != nullptr) {
768771
BoxWord* box_word = word_res->box_word;
@@ -831,7 +834,8 @@ bool Tesseract::word_display(PAGE_RES_IT* pr_it) {
831834
ScrollView::Color c = (ScrollView::Color)
832835
((int32_t) editor_image_blob_bb_color);
833836
image_win->Pen(c);
834-
c_it.set_to_list(word->cblob_list());
837+
// cblob iterator
838+
C_BLOB_IT c_it(word->cblob_list());
835839
for (c_it.mark_cycle_pt(); !c_it.cycled_list(); c_it.forward())
836840
c_it.data()->bounding_box().plot(image_win);
837841
displayed_something = true;

0 commit comments

Comments
 (0)