[MPlayer-cvslog] r32893 - trunk/gui/skin/font.c

ib subversion at mplayerhq.hu
Fri Feb 11 17:54:33 CET 2011


Author: ib
Date: Fri Feb 11 17:54:32 2011
New Revision: 32893

Log:
Prevent memory leaks.

Modified:
   trunk/gui/skin/font.c

Modified: trunk/gui/skin/font.c
==============================================================================
--- trunk/gui/skin/font.c	Fri Feb 11 17:34:29 2011	(r32892)
+++ trunk/gui/skin/font.c	Fri Feb 11 17:54:32 2011	(r32893)
@@ -55,6 +55,7 @@ void fntFreeFont( void )
    if ( Fonts[i] )
     {
      free( Fonts[i]->Bitmap.Image );
+     Fonts[i]->Bitmap.Image=NULL;
      free( Fonts[i] );
      Fonts[i]=NULL;
     }
@@ -128,6 +129,13 @@ int fntRead( char * path,char * fname )
         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;
          }


More information about the MPlayer-cvslog mailing list