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:20:40 +0300
commit8d556c53e376708850f1f1be0234dce241249266 (patch)
tree9f708baf816973915a975f564b63707b8cc0eac7
parent20657abbd92e0d5c24c2e15b4877b6bca20c8167 (diff)
downloadnautilus-8d556c53e376708850f1f1be0234dce241249266.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);
}