[MPlayer-cvslog] r33567 - trunk/m_config.c

ib subversion at mplayerhq.hu
Mon Jun 6 16:55:07 CEST 2011


Author: ib
Date: Mon Jun  6 16:55:06 2011
New Revision: 33567

Log:
Pass m_config_new() error information to caller.

If allocation fails, return NULL instead of continuing.

Modified:
   trunk/m_config.c

Modified: trunk/m_config.c
==============================================================================
--- trunk/m_config.c	Mon Jun  6 16:10:09 2011	(r33566)
+++ trunk/m_config.c	Mon Jun  6 16:55:06 2011	(r33567)
@@ -161,6 +161,7 @@ m_config_new(void) {
   int i;
 
   config = calloc(1,sizeof(m_config_t));
+  if (!config) return NULL;
   config->lvl = 1; // 0 Is the defaults
   if(!initialized) {
     initialized = 1;
@@ -169,6 +170,10 @@ m_config_new(void) {
     profile_opt_type.set = set_profile;
   }
   config->self_opts = malloc(sizeof(ref_opts));
+  if (!config->self_opts) {
+    free(config);
+    return NULL;
+  }
   memcpy(config->self_opts,ref_opts,sizeof(ref_opts));
   for(i = 0 ; config->self_opts[i].name ; i++)
     config->self_opts[i].priv = config;


More information about the MPlayer-cvslog mailing list