comparison gui/skin/font.c @ 32806:759c37107a99

Prevent memory leaks.
author ib
date Fri, 11 Feb 2011 16:54:32 +0000
parents 5b8cac96cec9
children abc6b4c527b5
comparison
equal deleted inserted replaced
32805:5b8cac96cec9 32806:759c37107a99
53 for( i=0;i < MAX_FONTS;i++ ) 53 for( i=0;i < MAX_FONTS;i++ )
54 { 54 {
55 if ( Fonts[i] ) 55 if ( Fonts[i] )
56 { 56 {
57 free( Fonts[i]->Bitmap.Image ); 57 free( Fonts[i]->Bitmap.Image );
58 Fonts[i]->Bitmap.Image=NULL;
58 free( Fonts[i] ); 59 free( Fonts[i] );
59 Fonts[i]=NULL; 60 Fonts[i]=NULL;
60 } 61 }
61 } 62 }
62 } 63 }
126 { 127 {
127 av_strlcpy( tmp,path,sizeof( tmp ) ); av_strlcat( tmp,param,sizeof( tmp ) ); 128 av_strlcpy( tmp,path,sizeof( tmp ) ); av_strlcat( tmp,param,sizeof( tmp ) );
128 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[font] image file: %s\n",tmp ); 129 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[font] image file: %s\n",tmp );
129 if ( skinBPRead( tmp,&Fonts[id]->Bitmap ) ) 130 if ( skinBPRead( tmp,&Fonts[id]->Bitmap ) )
130 { 131 {
132 if (Fonts[id]->Bitmap.Image)
133 {
134 free(Fonts[id]->Bitmap.Image);
135 Fonts[id]->Bitmap.Image = NULL;
136 }
137 free(Fonts[id]);
138 Fonts[id] = NULL;
131 fclose(f); 139 fclose(f);
132 return -4; 140 return -4;
133 } 141 }
134 } 142 }
135 } 143 }