summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-10-23 13:35:56 +0200
committerraveit65 <[email protected]>2022-01-26 22:03:18 +0100
commit4b437e916ec159f4083d864cf44532ddf1d8c01f (patch)
tree17dc808328e17e8895b205f54b100513727a6d8e
parentf0ddbff61110789200bede05aef7931fee060944 (diff)
downloadmarco-4b437e916ec159f4083d864cf44532ddf1d8c01f.tar.bz2
marco-4b437e916ec159f4083d864cf44532ddf1d8c01f.tar.xz
prefs: fix memory leak
-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