[MPlayer-cvslog] r37168 - trunk/gui/interface.c

ib subversion at mplayerhq.hu
Thu Apr 24 14:50:14 CEST 2014


Author: ib
Date: Thu Apr 24 14:50:14 2014
New Revision: 37168

Log:
Rewrite add_vf().

Prefer calloc() to malloc().
As a result, vf_settings[1] doesn't need to be cleared.

Additionally, check the result of the allocation.

Modified:
   trunk/gui/interface.c

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Thu Apr 24 14:44:33 2014	(r37167)
+++ trunk/gui/interface.c	Thu Apr 24 14:50:14 2014	(r37168)
@@ -299,10 +299,13 @@ static void add_vf(const char *vf)
             memset(&vf_settings[i + 1], 0, sizeof(m_obj_settings_t));
         }
     } else {
-        vf_settings = malloc(2 * sizeof(m_obj_settings_t));
+        vf_settings = calloc(2, sizeof(m_obj_settings_t));
+
+        if (!vf_settings)
+            return;
+
         vf_settings[0].name    = strdup(vf);
         vf_settings[0].attribs = NULL;
-        vf_settings[1].name    = NULL;
     }
 
     mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_AddingVideoFilter, vf);


More information about the MPlayer-cvslog mailing list