diff --git a/cfgparser.c b/cfgparser.c index 1dde14ed89..08a0a5396d 100644 --- a/cfgparser.c +++ b/cfgparser.c @@ -647,7 +647,7 @@ static int config_read_option(m_config_t *config,config_t** conf_list, char *opt goto out; } ret = 1; - res = malloc((n+1)*sizeof(char*)); + res = malloc((n+2)*sizeof(char*)); ptr = param; n = 0; // while(ptr[0] != '\0') { diff --git a/m_option.c b/m_option.c index 75645c15ee..14da9809c4 100644 --- a/m_option.c +++ b/m_option.c @@ -498,7 +498,7 @@ static int parse_str_list(m_option_t* opt,char *name, char *param, void* dst, in if(!dst) return 1; - res = malloc((n+1)*sizeof(char*)); + res = malloc((n+2)*sizeof(char*)); ptr = param; n = 0;