Mercurial > mplayer.hg
changeset 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 | a86e08ff3198 |
children | e413b573e4ec |
files | m_config.c |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
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;