Re: GSList and g_filename_from_uri free memory problem


Colossus wrote:

I have this code:

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);

The problem is that when I free filename the GSList data becames corrupted, but the docs says that g_filename_from_uri returns allocated memory, so what can I do ? Once I put filename in the GSList I don't need it anymore. Is filename freed when I call g_slist_free ?

just don't fre the filenames now. Free the filenames when you free the list.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]