Commit 8d50bb67 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

gdi32: Add a helper to free a face object and fix a potential memory leak.

parent b5115f77
......@@ -1668,6 +1668,15 @@ static inline void get_fontsig( FT_Face ft_face, FONTSIGNATURE *fs )
}
}
static inline void free_face( Face *face )
{
HeapFree( GetProcessHeap(), 0, face->file );
HeapFree( GetProcessHeap(), 0, face->StyleName );
HeapFree( GetProcessHeap(), 0, face->FullName );
HeapFree( GetProcessHeap(), 0, face->cached_enum_data );
HeapFree( GetProcessHeap(), 0, face );
}
#define ADDFONT_EXTERNAL_FONT 0x01
#define ADDFONT_FORCE_BITMAP 0x02
#define ADDFONT_ADD_TO_CACHE 0x04
......@@ -1709,10 +1718,7 @@ static void AddFaceToList(FT_Face ft_face, const char *file, void *font_data_ptr
} else {
TRACE("Replacing original with this one\n");
list_remove(&face->entry);
HeapFree(GetProcessHeap(), 0, face->file);
HeapFree(GetProcessHeap(), 0, face->StyleName);
HeapFree(GetProcessHeap(), 0, face->FullName);
HeapFree(GetProcessHeap(), 0, face);
free_face( face );
break;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment