Fix memory leak in loadlang_test

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2018-11-13 09:09:10 +01:00
parent 74f6d0e7ff
commit 5209aa6c95

View File

@ -16,6 +16,7 @@
// limitations under the License.
///////////////////////////////////////////////////////////////////////
#include <memory> // std::unique_ptr
#include <time.h>
#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<tesseract::TessBaseAPI> api(new tesseract::TessBaseAPI());
ASSERT_FALSE(api->Init(tessdatadir, lang))
<< "Could not initialize tesseract for $lang.";
api->End();