Fix a memory leak if a setting is registered multiple times (#844)

If a string setting is registered multiple times, the previous
default value wasn't freed, leading to a memory leak.
This commit is contained in:
Marcus Weseloh 2021-04-11 19:32:43 +02:00 committed by GitHub
parent aad6288955
commit aa966e4c31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -546,6 +546,7 @@ fluid_settings_register_str(fluid_settings_t *settings, const char *name, const
if(node->type == FLUID_STR_TYPE)
{
fluid_str_setting_t *setting = &node->str;
FLUID_FREE(setting->def);
setting->def = def ? FLUID_STRDUP(def) : NULL;
setting->hints = hints;
retval = FLUID_OK;