From 936ca00c44651ea5de947e1745a2c9f2fae06e56 Mon Sep 17 00:00:00 2001 From: Raf Schietekat Date: Wed, 10 May 2017 12:17:07 +0200 Subject: [PATCH] RAII: pdfrenderer.cpp: cidtogidmap --- api/pdfrenderer.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/api/pdfrenderer.cpp b/api/pdfrenderer.cpp index 1039368abe..1a750241e4 100644 --- a/api/pdfrenderer.cpp +++ b/api/pdfrenderer.cpp @@ -570,14 +570,13 @@ bool TessPDFRenderer::BeginDocumentHandler() { // CIDTOGIDMAP const int kCIDToGIDMapSize = 2 * (1 << 16); - unsigned char *cidtogidmap = new unsigned char[kCIDToGIDMapSize]; + const std::unique_ptr cidtogidmap(new unsigned char[kCIDToGIDMapSize]); for (int i = 0; i < kCIDToGIDMapSize; i++) { cidtogidmap[i] = (i % 2) ? 1 : 0; } size_t len; unsigned char *comp = - zlibCompress(cidtogidmap, kCIDToGIDMapSize, &len); - delete[] cidtogidmap; + zlibCompress(cidtogidmap.get(), kCIDToGIDMapSize, &len); n = snprintf(buf, sizeof(buf), "5 0 obj\n" "<<\n"