Avoid memory leaks when overwriting existing values

This commit is contained in:
Pierre Pronchery 2015-10-08 18:58:12 +02:00
parent e66d412682
commit a86b9ed02e

View File

@ -150,7 +150,11 @@ int config_set(Config * config, char const * section, char const * variable,
string_delete(newvalue);
return 1;
}
string_delete(oldvalue);
if(oldvalue != NULL)
{
string_delete(p);
string_delete(oldvalue);
}
return 0;
}