changeset 28336:89644e8d4323

Plug leaks in the file-selector code.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 07 Oct 2009 20:23:16 +0000
parents 42fc2fc14db2
children 650ab9eb4b21
files finch/libgnt/gntfilesel.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/gntfilesel.c	Tue Oct 06 15:58:05 2009 +0000
+++ b/finch/libgnt/gntfilesel.c	Wed Oct 07 20:23:16 2009 +0000
@@ -176,9 +176,13 @@
 	splits = g_strsplit(path, G_DIR_SEPARATOR_S, -1);
 	for (i = 0, j = 0; splits[i]; i++) {
 		if (strcmp(splits[i], ".") == 0) {
+			g_free(splits[i]);
+			splits[i] = NULL;
 		} else if (strcmp(splits[i], "..") == 0) {
 			if (j)
 				j--;
+			g_free(splits[i]);
+			splits[i] = NULL;
 		} else {
 			if (i != j) {
 				g_free(splits[j]);
@@ -625,6 +629,7 @@
 
 	sel->files = gnt_tree_new_with_columns(2);  /* Name, Size */
 	gnt_tree_set_compare_func(GNT_TREE(sel->files), (GCompareFunc)g_utf8_collate);
+	gnt_tree_set_hash_fns(GNT_TREE(sel->files), g_str_hash, g_str_equal, g_free);
 	gnt_tree_set_column_titles(GNT_TREE(sel->files), "Filename", "Size");
 	gnt_tree_set_show_title(GNT_TREE(sel->files), TRUE);
 	gnt_tree_set_col_width(GNT_TREE(sel->files), 0, 25);