Skip to content

Commit

Permalink
Fix GCC 5.2 warnings for freeing const char ptrs introduced in 6e72297.
Browse files Browse the repository at this point in the history
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
  • Loading branch information
troglobit committed Oct 20, 2015
1 parent bb6722c commit f867a2b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/confuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ cfg_setopt(cfg_t *cfg, cfg_opt_t *opt, const char *value)
{
cfg_value_t *val = 0;
int b;
char *s;
const char *s;
double f;
long int i;
void *p;
Expand Down Expand Up @@ -692,7 +692,9 @@ cfg_setopt(cfg_t *cfg, cfg_opt_t *opt, const char *value)
return 0;
}
else
{
s = value;
}
free(val->string);
val->string = strdup(s);
break;
Expand Down Expand Up @@ -1374,11 +1376,11 @@ static void cfg_free_opt_array(cfg_opt_t *opts)

for(i = 0; opts[i].name; ++i)
{
free(opts[i].name);
free((void *)opts[i].name);
if(opts[i].type == CFGT_FUNC || is_set(CFGF_LIST, opts[i].flags))
free(opts[i].def.parsed);
else if(opts[i].type == CFGT_STR)
free(opts[i].def.string);
free((void *)opts[i].def.string);
else if(opts[i].type == CFGT_SEC)
cfg_free_opt_array(opts[i].subopts);
}
Expand Down

0 comments on commit f867a2b

Please sign in to comment.