Skip to content

Commit 6b982bb

Browse files
committed
Fix memory error + leak in fontface cache (#4794)
1 parent 61592a7 commit 6b982bb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fontcache.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ void msFreeFontCache(ft_cache *c) {
8686
}
8787
#endif
8888
FT_Done_Face(cur_face->face);
89+
free(cur_face->font);
8990
UT_HASH_DEL(c->face_cache,cur_face);
9091
free(cur_face);
9192
}
@@ -227,9 +228,10 @@ face_element* msGetFontFace(char *key, fontSetObj *fontset) {
227228
FT_Select_Charmap(fc->face, FT_ENCODING_APPLE_ROMAN);
228229
/* the previous calls may have failed, we ignore as there's nothing much left to do */
229230
}
230-
fc->font = key;
231+
fc->font = msStrdup(key);
231232
UT_HASH_ADD_KEYPTR(hh,cache->face_cache,fc->font, strlen(key), fc);
232233
}
234+
233235
return fc;
234236
}
235237

0 commit comments

Comments
 (0)