[nautilus] clipboard: free item list



commit 12476f47ecf012a80734e5d9aa4f7f17ab81b3bd
Author: Ernestas Kulik <ernestask src gnome org>
Date:   Sat Nov 12 22:45:55 2016 +0200

    clipboard: free item list
    
    The item list in nautilus_clipboard_is_cut_from_selection_data () is
    never freed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=774232

 src/nautilus-clipboard.c |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)
---
diff --git a/src/nautilus-clipboard.c b/src/nautilus-clipboard.c
index 957e11b..808ac1b 100644
--- a/src/nautilus-clipboard.c
+++ b/src/nautilus-clipboard.c
@@ -213,21 +213,15 @@ gboolean
 nautilus_clipboard_is_cut_from_selection_data (GtkSelectionData *selection_data)
 {
     GList *items;
+    gboolean is_cut_from_selection_data;
 
     items = get_item_list_from_selection_data (selection_data);
-    if (items == NULL)
-    {
-        return FALSE;
-    }
+    is_cut_from_selection_data = items != NULL &&
+                                 g_strcmp0 ((gchar *)items->data, "cut") == 0;
 
-    if (strcmp ((gchar *) items->data, "cut") == 0)
-    {
-        return TRUE;
-    }
-    else
-    {
-        return FALSE;
-    }
+    g_list_free_full (items, g_free);
+
+    return is_cut_from_selection_data;
 }
 
 static void


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