hostlist: add preconditions and clear host_list memory.