Rather than performing the list iteration and the list free as separate steps, free the list link while iterating.