Skip to content

Commit

Permalink
Use lept_free to free memory allocated by Leptonica
Browse files Browse the repository at this point in the history
This fixes problems on Windows when Tesseract and Leptonica use different
C runtime libraries.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Jul 16, 2017
1 parent f4f66f8 commit ba95a68
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ccstruct/imagedata.cpp
Expand Up @@ -331,7 +331,7 @@ void ImageData::SetPixInternal(Pix* pix, GenericVector<char>* 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.
Expand Down
2 changes: 1 addition & 1 deletion viewer/scrollview.cpp
Expand Up @@ -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.
Expand Down

0 comments on commit ba95a68

Please sign in to comment.