mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 14:41:36 +08:00
Fixed some leaks
git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@1143 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
parent
9f4d6fd668
commit
6fcede5c48
@ -117,8 +117,6 @@ static void InitFontconfig() {
|
||||
FLAGS_fontconfig_tmpdir.c_str(), "*cache-2").c_str());
|
||||
}
|
||||
tprintf("Initializing fontconfig\n");
|
||||
string fonts_dir = File::JoinPath(
|
||||
FLAGS_fonts_dir.c_str(), "google3/ocr/trainingdata/typesetting/testdata");
|
||||
const int MAX_FONTCONF_FILESIZE = 1024;
|
||||
char fonts_conf_template[MAX_FONTCONF_FILESIZE];
|
||||
snprintf(fonts_conf_template, MAX_FONTCONF_FILESIZE,
|
||||
@ -478,6 +476,10 @@ bool FontUtils::IsAvailableFont(const char* input_query_desc) {
|
||||
}
|
||||
g_object_unref(context);
|
||||
}
|
||||
if (selected_font == NULL) {
|
||||
pango_font_description_free(desc);
|
||||
return false;
|
||||
}
|
||||
PangoFontDescription* selected_desc = pango_font_describe(selected_font);
|
||||
|
||||
bool equal = pango_font_description_equal(desc, selected_desc);
|
||||
@ -491,6 +493,7 @@ bool FontUtils::IsAvailableFont(const char* input_query_desc) {
|
||||
|
||||
g_free(selected_desc_str);
|
||||
pango_font_description_free(selected_desc);
|
||||
g_object_unref(selected_font);
|
||||
pango_font_description_free(desc);
|
||||
return equal;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user