Skip to content

Commit

Permalink
Fixed two memory leaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
frank4565 committed Jan 25, 2014
1 parent c6aeaff commit f00f8e6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Classes/Tesseract.mm
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,17 @@ - (BOOL)recognize {

- (NSString *)recognizedText {
char* utf8Text = _tesseract->GetUTF8Text();
return [NSString stringWithUTF8String:utf8Text];
NSString *text = [NSString stringWithUTF8String:utf8Text];
delete[] utf8Text;
return text;
}

- (void)clear
{
free(_pixels);
_tesseract->Clear();
_tesseract->End();
delete _tesseract;
}

- (void)setImage:(UIImage *)image
Expand Down

0 comments on commit f00f8e6

Please sign in to comment.