[nautilus] view: plug memory leaks



commit b20990b1eb4d1d4636d409f3235133358994059a
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sun Jan 25 17:10:53 2015 +0000

    view: plug memory leaks
    
    We were not freeing the strings coming from the undo manager.

 src/nautilus-view.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index 5d5ff9b..7443f4a 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -6441,8 +6441,8 @@ real_update_toolbar_menus (NautilusView *view)
                                                     &redo_label, &redo_description);
        }
 
-       undo_label = undo_active ? undo_label : _("Undo");
-       redo_label = redo_active ? redo_label : _("Redo");
+       undo_label = undo_active ? undo_label : g_strdup (_("Undo"));
+       redo_label = redo_active ? redo_label : g_strdup (_("Redo"));
        undo_menu_item = g_menu_item_new (undo_label, "view.undo");
        redo_menu_item = g_menu_item_new (redo_label, "view.redo");
        nautilus_toolbar_action_menu_add_item (toolbar, undo_menu_item, "undo-redo-section");
@@ -6452,6 +6452,10 @@ real_update_toolbar_menus (NautilusView *view)
 
        g_object_unref (undo_menu_item);
        g_object_unref (redo_menu_item);
+       g_free (undo_label);
+       g_free (undo_description);
+       g_free (redo_label);
+       g_free (redo_description);
 }
 
 /* Convenience function to reset the menus owned by the but that are managed on


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