Bz/fix freebsd

Fix issues. Tested with freeBSD 9.2 and 10.
Also, I don't see anything in the [spec](http://pubs.opengroup.org/onlinepubs/9699919799/functions/freeaddrinfo.html) that confirms that it should not be allocated if there is an error. It only says it will be allocated if there is not an error.