The function call freeaddrinfo() frees the memory of one or more addrinfo() structures returned by the getaddrinfo() or getnameinfo() functions.
#include <netdb.h>
void freeaddrinfo(struct addrinfo *ai);
*ai: pointer to the structure addrinfo.