summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammed Sadiq <sadiq@sadiqpk.org>2017-05-02 22:44:07 +0530
committerErnestas Kulik <ernestask@gnome.org>2017-05-05 17:14:56 +0300
commitec52282f157803585ff92c888e5b2c0b0fb76c5b (patch)
treee3a022bcf42557a86d4a8e35de70ffce4817dd83
parent1ca554b8721f823aeafe7a8cc383f88868cfe583 (diff)
downloadnautilus-ec52282f157803585ff92c888e5b2c0b0fb76c5b.tar.gz
toolbar: Don't leak previous allocations
When undo_active/redo_active is FALSE, undo_label/redo_label was getting overwritten irrespective of whether they were NULL or not. Let the label values be freed incase they are updated. https://bugzilla.gnome.org/show_bug.cgi?id=782083
-rw-r--r--src/nautilus-toolbar.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index e78dffe92..c8c58341c 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -853,10 +853,18 @@ undo_manager_changed (NautilusToolbar *self)
/* Set the label of the undo and redo menu items, and activate them appropriately
*/
- undo_label = undo_active && undo_label != NULL ? undo_label : g_strdup (_("_Undo"));
+ if (!undo_active || undo_label == NULL)
+ {
+ g_free (undo_label);
+ undo_label = g_strdup (_("_Undo"));
+ }
update_menu_item (self->undo_button, self, "undo", undo_active, undo_label);
- redo_label = redo_active && redo_label != NULL ? redo_label : g_strdup (_("_Redo"));
+ if (!redo_active || redo_label == NULL)
+ {
+ g_free (redo_label);
+ redo_label = g_strdup (_("_Redo"));
+ }
update_menu_item (self->redo_button, self, "redo", redo_active, redo_label);
}