diff gui/skin/font.c @ 32712:6ff3cc81d602

Fix resource leaks and check for realloc failures (reported by cppcheck)
author ib
date Wed, 19 Jan 2011 22:02:58 +0000
parents 697fd62b65f9
children cc58a1e919d9
line wrap: on
line diff
--- a/gui/skin/font.c	Wed Jan 19 17:42:15 2011 +0000
+++ b/gui/skin/font.c	Wed Jan 19 22:02:58 2011 +0000
@@ -115,11 +115,16 @@
        {
         av_strlcpy( tmp,path,sizeof( tmp )  ); av_strlcat( tmp,param,sizeof( tmp ) );
         mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[font] font imagefile: %s\n",tmp );
-        if ( skinBPRead( tmp,&Fonts[id]->Bitmap ) ) return -4;
+        if ( skinBPRead( tmp,&Fonts[id]->Bitmap ) )
+         {
+          fclose(f);
+          return -4;
+         }
        }
      }
    }
 
+ fclose(f);
  return 0;
 }