Permalink
Browse files

Fix memory error + leak in fontface cache (#4794)

  • Loading branch information...
tbonfort committed Jun 16, 2015
1 parent 61592a7 commit 6b982bbf822c720061a22963baed409afcf8a8cf
Showing with 3 additions and 1 deletion.
  1. +3 −1 fontcache.c
View
@@ -86,6 +86,7 @@ void msFreeFontCache(ft_cache *c) {
}
#endif
FT_Done_Face(cur_face->face);
+ free(cur_face->font);
UT_HASH_DEL(c->face_cache,cur_face);
free(cur_face);
}
@@ -227,9 +228,10 @@ face_element* msGetFontFace(char *key, fontSetObj *fontset) {
FT_Select_Charmap(fc->face, FT_ENCODING_APPLE_ROMAN);
/* the previous calls may have failed, we ignore as there's nothing much left to do */
}
- fc->font = key;
+ fc->font = msStrdup(key);
UT_HASH_ADD_KEYPTR(hh,cache->face_cache,fc->font, strlen(key), fc);
}
+
return fc;
}

0 comments on commit 6b982bb

Please sign in to comment.