Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tesseractmain: Fix memory leak #2021

Merged
merged 1 commit into from
Oct 22, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
tesseractmain: Fix memory leak
Commit 49d7df6 introduced a memory leak
when the output file could not be created.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Oct 22, 2018
commit be0cf03778bc1c0ed81a5b45a39b15ae40cbcfdd
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