# HG changeset patch # User ib # Date 1297443272 0 # Node ID 759c37107a99073bd70e49ba0d2b48ee7412bd98 # Parent 5b8cac96cec976a7fec8da0c957e0eaf90054300 Prevent memory leaks. diff -r 5b8cac96cec9 -r 759c37107a99 gui/skin/font.c --- a/gui/skin/font.c Fri Feb 11 16:34:29 2011 +0000 +++ b/gui/skin/font.c Fri Feb 11 16:54:32 2011 +0000 @@ -55,6 +55,7 @@ if ( Fonts[i] ) { free( Fonts[i]->Bitmap.Image ); + Fonts[i]->Bitmap.Image=NULL; free( Fonts[i] ); Fonts[i]=NULL; } @@ -128,6 +129,13 @@ mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[font] image file: %s\n",tmp ); if ( skinBPRead( tmp,&Fonts[id]->Bitmap ) ) { + if (Fonts[id]->Bitmap.Image) + { + free(Fonts[id]->Bitmap.Image); + Fonts[id]->Bitmap.Image = NULL; + } + free(Fonts[id]); + Fonts[id] = NULL; fclose(f); return -4; }