There was a warning at the end of addrinfo_td because it returns a "void *" but had no return statement. The fix was call pthread_exit().