[gnome-terminal] search: Use the cleanup attribute to clean up



commit 7241c7a1bd2359f1933153c730fc2f29b4ecc642
Author: Christian Persch <chpe gnome org>
Date:   Mon Oct 21 17:55:46 2013 +0200

    search: Use the cleanup attribute to clean up

 src/terminal-search-dialog.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/src/terminal-search-dialog.c b/src/terminal-search-dialog.c
index 1873e63..5b6553d 100644
--- a/src/terminal-search-dialog.c
+++ b/src/terminal-search-dialog.c
@@ -22,6 +22,7 @@
 
 #include "terminal-search-dialog.h"
 #include "terminal-util.h"
+#include "terminal-libgsystem.h"
 
 #define HISTORY_MIN_ITEM_LEN 3
 #define HISTORY_LENGTH 10
@@ -195,17 +196,14 @@ remove_item (GtkListStore *store,
     return FALSE;
 
   do {
-    gchar *item_text;
+    gs_free gchar *item_text;
 
     gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, 0, &item_text, -1);
 
     if (item_text != NULL && strcmp (item_text, text) == 0) {
       gtk_list_store_remove (store, &iter);
-      g_free (item_text);
       return TRUE;
     }
-
-    g_free (item_text);
   } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter));
 
   return FALSE;


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