Frees all of the memory used by a GSList The freed elements are returned to the slice allocator.

If list elements contain dynamically-allocated memory, you should either use g_slist_free_full() or free them manually first.

It can be combined with g_steal_pointer() to ensure the list head pointer is not left dangling:

GSList *list_of_borrowed_things = …;  /<!-- -->* (transfer container) *<!-- -->/
g_slist_free (g_steal_pointer (&list_of_borrowed_things));
class ListSG