summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2018-11-30 01:51:35 +0100
committerraveit65 <[email protected]>2018-12-01 17:26:28 +0100
commit3a145a79594a00badaf145840f66a6007f79f812 (patch)
tree14ec344f86572b8f66212fff40605c2fc938e862
parent3ff3f275dff1028a5bd9bf9c91f6bee8c21e24c5 (diff)
downloadmate-terminal-3a145a79594a00badaf145840f66a6007f79f812.tar.bz2
mate-terminal-3a145a79594a00badaf145840f66a6007f79f812.tar.xz
terminal-profile: Fix memory leaks
'g_strconcat' needs to be freed
-rw-r--r--src/terminal-profile.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/terminal-profile.c b/src/terminal-profile.c
index 44a4672..738c80a 100644
--- a/src/terminal-profile.c
+++ b/src/terminal-profile.c
@@ -849,10 +849,12 @@ terminal_profile_save (TerminalProfile *profile)
TerminalProfilePrivate *priv = profile->priv;
GSettings *changeset;
GSList *l;
+ gchar *concat;
priv->save_idle_id = 0;
- changeset = g_settings_new_with_path (CONF_PROFILE_SCHEMA,
- g_strconcat (CONF_PROFILE_PREFIX, priv->profile_dir,"/", NULL));
+ concat = g_strconcat (CONF_PROFILE_PREFIX, priv->profile_dir,"/", NULL);
+ changeset = g_settings_new_with_path (CONF_PROFILE_SCHEMA, concat);
+ g_free (concat);
g_settings_delay (changeset);
for (l = priv->dirty_pspecs; l != NULL; l = l->next)
@@ -955,6 +957,7 @@ terminal_profile_constructor (GType type,
const char *name;
GParamSpec **pspecs;
guint n_pspecs, i;
+ gchar *concat;
object = G_OBJECT_CLASS (terminal_profile_parent_class)->constructor
(type, n_construct_properties, construct_params);
@@ -965,14 +968,18 @@ terminal_profile_constructor (GType type,
name = g_value_get_string (g_value_array_get_nth (priv->properties, PROP_NAME));
g_assert (name != NULL);
- priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA,
- g_strconcat (CONF_PROFILE_PREFIX, name, "/", NULL));
+ concat = g_strconcat (CONF_PROFILE_PREFIX, name, "/", NULL);
+ priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA, concat);
g_assert (priv->settings != NULL);
+ g_free (concat);
+ concat = g_strconcat("changed::", priv->profile_dir, "/", NULL);
g_signal_connect (priv->settings,
- g_strconcat("changed::", priv->profile_dir, "/", NULL),
+ concat,
G_CALLBACK(terminal_profile_gsettings_notify_cb),
profile);
+ g_free (concat);
+
/* Now load those properties from GSettings that were not set as construction params */
pspecs = g_object_class_list_properties (G_OBJECT_CLASS (TERMINAL_PROFILE_GET_CLASS (profile)), &n_pspecs);
for (i = 0; i < n_pspecs; ++i)
@@ -1123,16 +1130,20 @@ terminal_profile_set_property (GObject *object,
g_assert (name != NULL);
priv->profile_dir = g_strdup (name);
if (priv->settings != NULL) {
+ gchar *concat;
g_signal_handlers_disconnect_by_func (priv->settings,
G_CALLBACK(terminal_profile_gsettings_notify_cb),
profile);
g_object_unref (priv->settings);
- priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA,
- g_strconcat (CONF_PROFILE_PREFIX, priv->profile_dir, "/", NULL));
+ concat= g_strconcat (CONF_PROFILE_PREFIX, priv->profile_dir, "/", NULL);
+ priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA, concat);
+ g_free (concat);
+ concat = g_strconcat("changed::", priv->profile_dir, "/", NULL);
g_signal_connect (priv->settings,
- g_strconcat("changed::", priv->profile_dir, "/", NULL),
- G_CALLBACK(terminal_profile_gsettings_notify_cb),
+ concat,
+ G_CALLBACK(terminal_profile_gsettings_notify_cb),
profile);
+ g_free (concat);
}
break;
}