(trunk gtk) #2668 "small memory leak in getSelectedTorrentIds()" -- fixed for 1.80

This commit is contained in:
Charles Kerr 2009-12-14 16:41:49 +00:00
parent ee0de4b06c
commit 8e0e62187d
1 changed files with 5 additions and 2 deletions

View File

@ -134,12 +134,12 @@ getSelectedTorrentIds( struct cbdata * data )
GtkTreeSelection * s; GtkTreeSelection * s;
GtkTreeModel * model; GtkTreeModel * model;
GSList * ids = NULL; GSList * ids = NULL;
GList * selrows = NULL; GList * paths = NULL;
GList * l; GList * l;
/* build a list of the selected torrents' ids */ /* build a list of the selected torrents' ids */
s = tr_window_get_selection( data->wind ); s = tr_window_get_selection( data->wind );
for( selrows=l=gtk_tree_selection_get_selected_rows(s,&model); l; l=l->next ) { for( paths=l=gtk_tree_selection_get_selected_rows(s,&model); l; l=l->next ) {
GtkTreeIter iter; GtkTreeIter iter;
if( gtk_tree_model_get_iter( model, &iter, l->data ) ) { if( gtk_tree_model_get_iter( model, &iter, l->data ) ) {
tr_torrent * tor; tr_torrent * tor;
@ -148,6 +148,9 @@ getSelectedTorrentIds( struct cbdata * data )
} }
} }
/* cleanup */
g_list_foreach( paths, (GFunc)gtk_tree_path_free, NULL );
g_list_free( paths );
return ids; return ids;
} }