Skip to content

Commit

Permalink
Fix memory leak in loadlang_test
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Nov 13, 2018
1 parent 74f6d0e commit 5209aa6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion unittest/loadlang_test.cc
Expand Up @@ -16,6 +16,7 @@
// limitations under the License.
///////////////////////////////////////////////////////////////////////

#include <memory> // std::unique_ptr
#include <time.h>
#include "baseapi.h"
#include "include_gunit.h"
Expand All @@ -35,7 +36,7 @@ class QuickTest : public testing::Test {
};

void LangLoader(const char* lang, const char* tessdatadir) {
tesseract::TessBaseAPI* api = new tesseract::TessBaseAPI();
std::unique_ptr<tesseract::TessBaseAPI> api(new tesseract::TessBaseAPI());
ASSERT_FALSE(api->Init(tessdatadir, lang))
<< "Could not initialize tesseract for $lang.";
api->End();
Expand Down

0 comments on commit 5209aa6

Please sign in to comment.