# HG changeset patch # User ib # Date 1307372106 0 # Node ID a5a0019e1c28752b402010e23ccabf29a029d05a # Parent a86e08ff3198ae8f343a57c5ca1942b92ca98ce5 Pass m_config_new() error information to caller. If allocation fails, return NULL instead of continuing. diff -r a86e08ff3198 -r a5a0019e1c28 m_config.c --- 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;