summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCorentin Noël <corentin.noel@collabora.com>2019-05-07 10:02:57 +0200
committerCorentin Noël <corentin@elementary.io>2019-05-21 08:26:39 +0000
commitf46af86c6edbdf473da9101bb9418ee62ae79c3e (patch)
tree8a7193a1a930266e9b144a3571e94f4493493dd0 /src
parent55f03589e9c305cf3c4b9e108271a98a91da14cc (diff)
downloadglade-f46af86c6edbdf473da9101bb9418ee62ae79c3e.tar.gz
Couple of fixes for memory leaks found with valgrind
Most of them are unfreed string and missed GList elements.
Diffstat (limited to 'src')
-rw-r--r--src/glade-window.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/glade-window.c b/src/glade-window.c
index c290a399..253ff961 100644
--- a/src/glade-window.c
+++ b/src/glade-window.c
@@ -140,26 +140,27 @@ refresh_title (GladeWindow *window)
if (GLADE_WINDOW_ACTIVE_VIEW (window))
{
GladeProject *project = glade_design_view_get_project (GLADE_WINDOW_ACTIVE_VIEW (window));
- gchar *title, *name = NULL;
+ gchar *title;
GList *p;
gtk_header_bar_set_custom_title (window->priv->headerbar, NULL);
- name = glade_project_get_name (project);
-
+ title = glade_project_get_name (project);
if (glade_project_get_modified (project))
- name = g_strdup_printf ("*%s", name);
- else
- name = g_strdup (name);
+ {
+ gchar *old_title = g_steal_pointer (&title);
+ title = g_strdup_printf ("*%s", old_title);
+ g_free (old_title);
+ }
if (glade_project_get_readonly (project) != FALSE)
- title = g_strdup_printf ("%s %s", name, READONLY_INDICATOR);
- else
- title = g_strdup_printf ("%s", name);
+ {
+ gchar *old_title = g_steal_pointer (&title);
+ title = g_strdup_printf ("%s %s", old_title, READONLY_INDICATOR);
+ }
gtk_header_bar_set_title (window->priv->headerbar, title);
g_free (title);
- g_free (name);
if ((p = glade_app_get_projects ()) && g_list_next (p))
gtk_header_bar_set_custom_title (window->priv->headerbar, window->priv->project_switcher);