summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-10-23 13:35:56 +0200
committerraveit65 <[email protected]>2022-07-08 19:10:00 +0200
commit3624c5a41655df7c882aacd7e780f03609b895da (patch)
tree8de94bc4082d40589a4d775f592379c4c6db97e4 /src
parentebc99e2b034a370d644189295e8c5e0180e8f65d (diff)
downloadmarco-3624c5a41655df7c882aacd7e780f03609b895da.tar.bz2
marco-3624c5a41655df7c882aacd7e780f03609b895da.tar.xz
prefs: fix memory leak
Diffstat (limited to 'src')
-rw-r--r--src/core/prefs.c48
1 files changed, 27 insertions, 21 deletions
diff --git a/src/core/prefs.c b/src/core/prefs.c
index 0c11fff6..1198113a 100644
--- a/src/core/prefs.c
+++ b/src/core/prefs.c
@@ -1746,21 +1746,23 @@ static void
init_bindings (GSettings *settings)
{
GSettingsSchema *schema;
- gchar **list = NULL;
- gchar *str_val = NULL;
+ gchar **list;
+ gsize i;
g_object_get (settings, "settings-schema", &schema, NULL);
list = g_settings_schema_list_keys (schema);
g_settings_schema_unref (schema);
- while (*list != NULL)
+ for (i = 0; list[i] != NULL; i++)
{
- str_val = g_settings_get_string (settings, *list);
- update_key_binding (*list, str_val);
- list++;
+ gchar *str_val;
+
+ str_val = g_settings_get_string (settings, list[i]);
+ update_key_binding (list[i], str_val);
+ g_free (str_val);
}
- g_free (str_val);
+ g_strfreev (list);
}
static void
@@ -1779,42 +1781,46 @@ static void
init_commands (void)
{
GSettingsSchema *schema;
- gchar **list = NULL;
- gchar *str_val = NULL;
+ gchar **list;
+ gsize i;
g_object_get (settings_command, "settings-schema", &schema, NULL);
list = g_settings_schema_list_keys (schema);
g_settings_schema_unref (schema);
- while (*list != NULL)
+ for (i = 0; list[i] != NULL; i++)
{
- str_val = g_settings_get_string (settings_command, *list);
- update_command (*list, str_val);
- list++;
+ gchar *str_val;
+
+ str_val = g_settings_get_string (settings_command, list[i]);
+ update_command (list[i], str_val);
+ g_free (str_val);
}
- g_free (str_val);
+ g_strfreev (list);
}
static void
init_workspace_names (void)
{
GSettingsSchema *schema;
- gchar **list = NULL;
- gchar *str_val = NULL;
+ gchar **list;
+ gsize i;
g_object_get (settings_workspace_names, "settings-schema", &schema, NULL);
list = g_settings_schema_list_keys (schema);
g_settings_schema_unref (schema);
- while (*list != NULL)
+ for (i = 0; list[i] != NULL; i++)
{
- str_val = g_settings_get_string (settings_workspace_names, *list);
- update_workspace_name (*list, str_val);
- list++;
+ gchar *str_val;
+
+ str_val = g_settings_get_string (settings_workspace_names, list[i]);
+ update_workspace_name (list[i], str_val);
+ g_free (str_val);
}
- g_free (str_val);
+ g_strfreev (list);
}
static gboolean