add error handle for freeaddrinfo