Use list_for_each_entry_safe when cleaning peer hostnames

Change-Id: Ic41e6271129116bed71012e151480063aa3d76b9