[gnome-logs/wip/jonathankang/fix-mem-leak: 1/3] free strings to avoid memory leak



commit 363803d9bdf551d4b74c8bc15f375bdd83c44364
Author: Jonathan Kang <jonathankang gnome org>
Date:   Mon Mar 19 15:13:42 2018 +0800

    free strings to avoid memory leak
    
    Some strings are not freed when needed. Free them to avoid memory leak.

 src/gl-searchpopover.c |    4 ++++
 src/gl-window.c        |    5 +++--
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/gl-searchpopover.c b/src/gl-searchpopover.c
index 0822f7f..e1e6319 100644
--- a/src/gl-searchpopover.c
+++ b/src/gl-searchpopover.c
@@ -1002,6 +1002,8 @@ start_time_spinbox_value_changed (GtkSpinButton *spin_button,
 
     g_object_notify_by_pspec (G_OBJECT (popover),
                               obj_properties[PROP_JOURNAL_TIMESTAMP_RANGE]);
+
+    g_free (button_label);
 }
 
 static void
@@ -1241,6 +1243,8 @@ end_time_spinbox_value_changed (GtkSpinButton *spin_button,
 
     g_object_notify_by_pspec (G_OBJECT (popover),
                               obj_properties[PROP_JOURNAL_TIMESTAMP_RANGE]);
+
+    g_free (button_label);
 }
 
 static void
diff --git a/src/gl-window.c b/src/gl-window.c
index 65b67e8..a06f1d4 100644
--- a/src/gl-window.c
+++ b/src/gl-window.c
@@ -195,9 +195,9 @@ on_view_boot (GSimpleAction *action,
     GlEventToolbar *toolbar;
     GArray *boot_ids;
     GlJournalBootID *boot_id;
-    gchar *current_boot;
     const gchar *boot_match;
-    const gchar *latest_boot;
+    gchar *current_boot;
+    gchar *latest_boot;
 
     priv = gl_window_get_instance_private (GL_WINDOW (user_data));
     event_list = GL_EVENT_VIEW_LIST (priv->event_list);
@@ -224,6 +224,7 @@ on_view_boot (GSimpleAction *action,
     g_simple_action_set_state (action, variant);
 
     g_free (current_boot);
+    g_free (latest_boot);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]