To free memory allocated by getaddrinfo. This includes the addrinfo structures, the socket address structures, and canonical host name strings pointed to by the addrinfo structures.
Library (libc.a)
#include <sys/socket.h> #include <netdb.h> void freeaddrinfo (ai) struct addrinfo *ai;
This function frees any dynamic storage pointed to by elements of ai, as well as the space for ai itself. Also, it will descend the linked list, repeating this process for all nodes in the list until a NULL ai_next pointer is encountered.
The getaddrinfo subroutine, gai_strerror, and getnameinfo subroutine.