Re: Why there's still ONE element left after g_slist_free () ?



> I thought after g_slist_free (), the GSList should be empty(NULL), why still

When you say "the GSList should be NULL", what do you mean? You have a
GSList* variable that used to point to the list? Do you assign NULL to
that variable yourself? If not, it is not going to become NULL
magically by itself. After the call to g_slist_free(), the variable
just points to freed memory in the heap and should not be used.

This is not any different than complaining that after

char *p = malloc (42); free (p);

p is not NULL and the C library must be buggy.

--tml


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