Fix some memory leaks
This commit is contained in:
parent
61a1c6e39e
commit
48a8a79746
14
src/main.c
14
src/main.c
@ -951,6 +951,7 @@ int Init_program(int argc,char * argv[])
|
||||
// ------------------------- Fermeture du programme --------------------------
|
||||
void Program_shutdown(void)
|
||||
{
|
||||
int i;
|
||||
int return_code;
|
||||
|
||||
// Windows only: Recover the window position.
|
||||
@ -1008,7 +1009,18 @@ void Program_shutdown(void)
|
||||
}
|
||||
else
|
||||
Error(ERROR_MISSING_DIRECTORY);
|
||||
|
||||
|
||||
// Free Config
|
||||
#define FREE_POINTER(p) free(p); p = NULL
|
||||
FREE_POINTER(Config.Skin_file);
|
||||
FREE_POINTER(Config.Font_file);
|
||||
for (i=0;i<NB_BOOKMARKS;i++)
|
||||
{
|
||||
FREE_POINTER(Config.Bookmark_directory[i]);
|
||||
}
|
||||
|
||||
Uninit_text();
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
#if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__)
|
||||
|
||||
16
src/text.c
16
src/text.c
@ -383,6 +383,22 @@ int TrueType_is_supported()
|
||||
#endif
|
||||
}
|
||||
|
||||
void Uninit_text(void)
|
||||
{
|
||||
#ifndef NOTTF
|
||||
TTF_Quit();
|
||||
#if defined(USE_FC)
|
||||
FcFini();
|
||||
#endif
|
||||
#endif
|
||||
while (font_list_start != NULL)
|
||||
{
|
||||
T_Font * font = font_list_start->Next;
|
||||
free(font_list_start->Name);
|
||||
free(font_list_start);
|
||||
font_list_start = font;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NOTTF
|
||||
byte *Render_text_TTF(const char *str, int font_number, int size, int antialias, int bold, int italic, int *width, int *height, T_Palette palette)
|
||||
|
||||
@ -27,6 +27,8 @@
|
||||
|
||||
/// Initialization of text settings, needs to be called once on program startup.
|
||||
void Init_text(void);
|
||||
/// text settings cleanup. called on program shutdown
|
||||
void Uninit_text(void);
|
||||
/// Returns true if text.c was compiled with TrueType support.
|
||||
int TrueType_is_supported(void);
|
||||
/// Add a new font to the list to propose to the user.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user