changeset 32806:759c37107a99

Prevent memory leaks.
author ib
date Fri, 11 Feb 2011 16:54:32 +0000
parents 5b8cac96cec9
children 2564a237c211
files gui/skin/font.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;
          }