Fixed getaddrinfo parameter order
Fixed memory leak