Re: GSList and g_filename_from_uri free memory problem

On 2/23/06, Colossus <colossus 3000 it> wrote:
Gaurav Jain wrote:
All your "filenames" can be retrieved and freed by looping through the list:
Something like:
GSList *next_ptr = Files_to_Add;
while (next_ptr != NULL)
      g_free(next_ptr->data);  //this frees the filenames
      next_ptr = g_slist_next(next_ptr);
g_slist_free(Files_to_Add); //this frees the list

Hum, what about using directly Files_to_Add instead of next_ptr ?

you must pass the list's head node pointer to g_slist_free(), which
you will lost if you use Files_to_Add directly (in fact, it will
always be null after the while loop)

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