Fix g_list_free when called on non first item
If g_list_free was called on the nth item of a list, the nth - 1's next member was left pointing to an invalid item. This adds a check to see if g_list_free is being called on the first member, and if not, set the previous node's next member to NULL.