Properly free a GList and avoid potential memory corruption