Skip to content

Commit

Permalink
tesseractmain: Fix memory leak
Browse files Browse the repository at this point in the history
Commit 49d7df6 introduced a memory leak
when the output file could not be created.

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Oct 22, 2018
1 parent 55704d2 commit be0cf03
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/api/tesseractmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ static void PreloadRenderers(
if (renderer->happy()) {
renderers->push_back(renderer);
} else {
delete renderer;
tprintf("Error, could not create hOCR output file: %s\n",
strerror(errno));
}
Expand All @@ -427,6 +428,7 @@ static void PreloadRenderers(
if (renderer->happy()) {
renderers->push_back(renderer);
} else {
delete renderer;
tprintf("Error, could not create TSV output file: %s\n",
strerror(errno));
}
Expand All @@ -446,6 +448,7 @@ static void PreloadRenderers(
if (renderer->happy()) {
renderers->push_back(renderer);
} else {
delete renderer;
tprintf("Error, could not create PDF output file: %s\n",
strerror(errno));
}
Expand All @@ -458,6 +461,7 @@ static void PreloadRenderers(
if (renderer->happy()) {
renderers->push_back(renderer);
} else {
delete renderer;
tprintf("Error, could not create UNLV output file: %s\n",
strerror(errno));
}
Expand All @@ -470,6 +474,7 @@ static void PreloadRenderers(
if (renderer->happy()) {
renderers->push_back(renderer);
} else {
delete renderer;
tprintf("Error, could not create BOX output file: %s\n",
strerror(errno));
}
Expand All @@ -482,6 +487,7 @@ static void PreloadRenderers(
if (renderer->happy()) {
renderers->push_back(renderer);
} else {
delete renderer;
tprintf("Error, could not create TXT output file: %s\n",
strerror(errno));
}
Expand Down

0 comments on commit be0cf03

Please sign in to comment.