C:freeaddrinfo
lastmod 2026-11-10created 2019-09-093 edits
freeaddrinfo() is a C socket API function that frees the addrinfo linked list dynamically allocated and returned by getaddrinfo(). After iterating over the address list obtained from getaddrinfo() and creating a socket, you must free it with this function to avoid memory leaks. The header is netdb.h, and on Windows it is provided under the same name in ws2tcpip.h.