bugfix: freeaddrinfo should be called after connect
jansson: make valgrind happy