I would use g_slist_free_full() instead of this, so the loop above can be removed.