From ba95a686aa102c32118cd7d52784a364cc0febf1 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 16 Jul 2017 08:12:51 +0200 Subject: [PATCH] Use lept_free to free memory allocated by Leptonica This fixes problems on Windows when Tesseract and Leptonica use different C runtime libraries. Signed-off-by: Stefan Weil --- ccstruct/imagedata.cpp | 2 +- viewer/scrollview.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ccstruct/imagedata.cpp b/ccstruct/imagedata.cpp index b89ecb264e..dc1ae4eb7c 100644 --- a/ccstruct/imagedata.cpp +++ b/ccstruct/imagedata.cpp @@ -331,7 +331,7 @@ void ImageData::SetPixInternal(Pix* pix, GenericVector* image_data) { pixDestroy(&pix); image_data->resize_no_init(size); memcpy(&(*image_data)[0], data, size); - free(data); + lept_free(data); } // Returns the Pix image for the image_data. Must be pixDestroyed after use. diff --git a/viewer/scrollview.cpp b/viewer/scrollview.cpp index 41f40b610a..4a9e78eb50 100644 --- a/viewer/scrollview.cpp +++ b/viewer/scrollview.cpp @@ -809,7 +809,7 @@ void ScrollView::Image(struct Pix* image, int x_pos, int y_pos) { base64[code_len++] = kBase64Table[remainder & 63]; SendRawMessage(base64); delete [] base64; - free(data); + lept_free(data); } // Escapes the ' character with a \, so it can be processed by LUA.