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

ib subversion at mplayerhq.hu
Thu Aug 25 14:22:44 EEST 2016


Author: ib
Date: Thu Aug 25 14:22:44 2016
New Revision: 37890

Log:
Utilize fntFreeFont().

Call fntFreeFont() instead of freeing bmpFont members individually.

(Until memory for Bitmap has been allocated, it points to NULL. So
the call is always safe.)

Modified:
   trunk/gui/skin/font.c

Modified: trunk/gui/skin/font.c
==============================================================================
--- trunk/gui/skin/font.c	Thu Aug 25 14:21:00 2016	(r37889)
+++ trunk/gui/skin/font.c	Thu Aug 25 14:22:44 2016	(r37890)
@@ -96,12 +96,9 @@ void fntFreeFonts(void)
 {
     int i;
 
-    for (i = 0; i < MAX_FONTS; i++) {
-        if (Fonts[i]) {
-            bpFree(&Fonts[i]->Bitmap);
-            nfree(Fonts[i]);
-        }
-    }
+    for (i = 0; i < MAX_FONTS; i++)
+        if (Fonts[i])
+            fntFreeFont(i);
 }
 
 /**
@@ -132,7 +129,7 @@ int fntRead(char *path, char *fname)
     file = fopen(buf, "rt");
 
     if (!file) {
-        nfree(Fonts[id]);
+        fntFreeFont(id);
         return -3;
     }
 
@@ -191,8 +188,7 @@ int fntRead(char *path, char *fname)
             mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[font] image file: %s\n", buf);
 
             if (skinImageRead(buf, &Fonts[id]->Bitmap) != 0) {
-                bpFree(&Fonts[id]->Bitmap);
-                nfree(Fonts[id]);
+                fntFreeFont(id);
                 fclose(file);
                 return -4;
             }


More information about the MPlayer-cvslog mailing list