diff --git a/unittest/apiexample_test.cc b/unittest/apiexample_test.cc index 438b9216ad..281b4ac605 100644 --- a/unittest/apiexample_test.cc +++ b/unittest/apiexample_test.cc @@ -27,6 +27,7 @@ #include #include #include +#include // std::unique_ptr #include #include "baseapi.h" #include "include_gunit.h" @@ -55,7 +56,7 @@ void OCRTester(const char* imgname, const char* groundtruth, file.imbue(loc); // Use it for file input std::string gtText((std::istreambuf_iterator(file)), std::istreambuf_iterator()); - tesseract::TessBaseAPI* api = new tesseract::TessBaseAPI(); + std::unique_ptr api(new tesseract::TessBaseAPI()); ASSERT_FALSE(api->Init(tessdatadir, lang)) << "Could not initialize tesseract."; Pix* image = pixRead(imgname);