From ebba2ef6a0491f441bda5c85e57b0e11965dd5f1 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Fri, 8 Aug 2014 20:25:07 +0200 Subject: Fix leak in ListBox::GetSelection() on GTK --- gtk/PlatGTK.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index ac90dee2a..2637e5d99 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -1805,6 +1805,7 @@ void ListBoxX::Select(int n) { } int ListBoxX::GetSelection() { + int index = -1; GtkTreeIter iter; GtkTreeModel *model; GtkTreeSelection *selection; @@ -1814,9 +1815,10 @@ int ListBoxX::GetSelection() { int *indices = gtk_tree_path_get_indices(path); // Don't free indices. if (indices) - return indices[0]; + index = indices[0]; + gtk_tree_path_free(path); } - return -1; + return index; } int ListBoxX::Find(const char *prefix) { -- cgit v1.2.3