Mercurial > mplayer.hg
diff m_config.c @ 33479:a5a0019e1c28
Pass m_config_new() error information to caller.
If allocation fails, return NULL instead of continuing.
author | ib |
---|---|
date | Mon, 06 Jun 2011 14:55:06 +0000 |
parents | 30e60125c2f4 |
children | 389d43c448b3 |
line wrap: on
line diff
--- a/m_config.c Mon Jun 06 14:10:09 2011 +0000 +++ b/m_config.c Mon Jun 06 14:55:06 2011 +0000 @@ -161,6 +161,7 @@ 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 @@ 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;