> gchar **array = NULL;: > array = gtk_selection_data_get_uris ( data ); > while (array[len]) > { > filename = g_filename_from_uri ( array[len] , NULL, NULL ); > Files_to_Add = g_slist_prepend ( Files_to_Add , filename ); > g_free (filename); > len++; > }
You can do the following to avoid memory leaks... array = gtk_selection_data_get_uris ( data ); /// check array != NULL len = 0 while (array[len]) { filename = g_filename_from_uri ( array[len] , NULL, NULL ); Files_to_Add = g_slist_prepend ( Files_to_Add , filename ); //g_free (filename); len++; } g_strfreev (array); //free the array of strings returned by .._get_uris () /// /// use the Files_to_Add list in your program /// g_slist_foreach (Files_to_Add, g_free, NULL); // free each element of the list (which is a pointer to an allocated string) g_slist_free (Files_to_Add); // free the memory occupied by the list itself I hope this helps... Regards, Santhosh. _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list