From 5209aa6c95b2c32e6ecf82987e77419df57ac1a4 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Tue, 13 Nov 2018 09:09:10 +0100 Subject: [PATCH] Fix memory leak in loadlang_test Signed-off-by: Stefan Weil --- unittest/loadlang_test.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/unittest/loadlang_test.cc b/unittest/loadlang_test.cc index aba2945d..01b467f8 100644 --- a/unittest/loadlang_test.cc +++ b/unittest/loadlang_test.cc @@ -16,6 +16,7 @@ // limitations under the License. /////////////////////////////////////////////////////////////////////// +#include // std::unique_ptr #include #include "baseapi.h" #include "include_gunit.h" @@ -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 api(new tesseract::TessBaseAPI()); ASSERT_FALSE(api->Init(tessdatadir, lang)) << "Could not initialize tesseract for $lang."; api->End();