From: Enrico Tröger Date: Fri, 17 Apr 2009 01:27:15 +0000 (+0200) Subject: Add missing NULL check and fix a memory leak in the Addons panel X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b7876cdf7175525d8ab1e72e197355ec73da9d9;p=midori Add missing NULL check and fix a memory leak in the Addons panel --- diff --git a/panels/midori-addons.c b/panels/midori-addons.c index 122809e8..4faa69e1 100644 --- a/panels/midori-addons.c +++ b/panels/midori-addons.c @@ -318,8 +318,12 @@ _treeview_first_selected_path (GtkTreeView *treeview) if (gtk_tree_selection_get_selected (selection, NULL, NULL)) { + GtkTreePath* result; tree_paths = gtk_tree_selection_get_selected_rows (selection, NULL); - return g_list_nth_data (tree_paths, 0); + result = gtk_tree_path_copy (g_list_nth_data (tree_paths, 0)); + g_list_foreach (tree_paths, (GFunc)gtk_tree_path_free, NULL); + g_list_free (tree_paths); + return result; } else return NULL; @@ -367,7 +371,7 @@ midori_addons_treeview_cursor_changed (GtkTreeView* treeview, path = _treeview_first_selected_path (treeview); model = gtk_tree_view_get_model (treeview); - if (gtk_tree_model_get_iter (model, &iter, path)) + if (path && gtk_tree_model_get_iter (model, &iter, path)) { gtk_tree_model_get (model, &iter, 0, &element, -1); if (element->broken)