From aa966e4c310c94e1954fb7a244ea3c8f1d49b39f Mon Sep 17 00:00:00 2001 From: Marcus Weseloh Date: Sun, 11 Apr 2021 19:32:43 +0200 Subject: [PATCH] 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. --- src/utils/fluid_settings.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/fluid_settings.c b/src/utils/fluid_settings.c index 3ba2c2e4..2d9f7b10 100644 --- a/src/utils/fluid_settings.c +++ b/src/utils/fluid_settings.c @@ -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;