From 179be6fd1f715bac570e73aa9cadb0e08d0f7979 Mon Sep 17 00:00:00 2001 From: divverent Date: Fri, 12 Nov 2010 18:40:47 +0000 Subject: [PATCH] Store the data pointer and free it on Font_UnloadFont git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10588 d7cf8633-e32d-0410-b094-e92efae38249 --- ft2.c | 5 +++++ ft2.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ft2.c b/ft2.c index f5efcabb..47958d74 100644 --- a/ft2.c +++ b/ft2.c @@ -510,6 +510,7 @@ static qboolean Font_LoadFile(const char *name, int _face, ft2_settings_t *setti _face = 0; status = qFT_New_Memory_Face(font_ft2lib, (FT_Bytes)data, datasize, 0, (FT_Face*)&font->face); } + font->data = data; if (status) { Con_Printf("ERROR: can't create face for %s\n" @@ -981,6 +982,10 @@ void Font_UnloadFont(ft2_font_t *font) font->face = NULL; } } + if (font->data) { + Mem_Free(font->data); + font->data = NULL; + } } static float Font_SearchSize(ft2_font_t *font, FT_Face fontface, float size) diff --git a/ft2.h b/ft2.h index b8d8cd5c..78728c2d 100644 --- a/ft2.h +++ b/ft2.h @@ -43,7 +43,7 @@ typedef struct ft2_font_s // TODO: clean this up and do not expose everything. - //unsigned char *data; + unsigned char *data; // TODO: See if FT2 actually needs it to stay... probably does //fs_offset_t datasize; void *face; -- 2.39.2