pidgin: 834bb4ff: Plug leaks in the file-selector code.

sadrul at pidgin.im sadrul at pidgin.im
Thu Oct 8 00:02:35 EDT 2009


-----------------------------------------------------------------
Revision: 834bb4ff0e4888f70c027426a0beca90285fa5b2
Ancestor: dc9a1245c614372c3eb72de56c563cc1453c8802
Author: sadrul at pidgin.im
Date: 2009-10-07T20:23:16
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/834bb4ff0e4888f70c027426a0beca90285fa5b2

Modified files:
        finch/libgnt/gntfilesel.c

ChangeLog: 

Plug leaks in the file-selector code.

-------------- next part --------------
============================================================
--- finch/libgnt/gntfilesel.c	2814dbc419c8d0b4138f786cd650d27d224e6f27
+++ finch/libgnt/gntfilesel.c	f6fe5c3acc4ef431efcfd25d2468d0d6707880e9
@@ -176,9 +176,13 @@ process_path(const char *path)
 	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 @@ gnt_file_sel_init(GTypeInstance *instanc
 
 	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);


More information about the Commits mailing list