FreeAddrInfoEx function (ws2tcpip.h)

The FreeAddrInfoEx function frees address information that the GetAddrInfoEx function dynamically allocates in addrinfoex structures.


void WSAAPI FreeAddrInfoEx(



A pointer to the addrinfoex structure or linked list of addrinfoex structures to be freed. All dynamic storage pointed to within the addrinfoex structure or structures is also freed.

Return value

This function does not return a value.


The FreeAddrInfoEx function frees addrinfoex structures dynamically allocated by the GetAddrInfoEx function. The FreeAddrInfoEx function frees the initial addrinfoex structure pointed to in the pAddrInfo parameter, including any buffers to which structure members point, then continues freeing any addrinfoex structures linked by the ai_next member of the addrinfoex structure. The FreeAddrInfoEx function continues freeing linked structures until a NULL ai_next member is encountered.

When UNICODE or _UNICODE is defined, FreeAddrInfoEx is defined to FreeAddrInfoExW, the Unicode version of the function, and ADDRINFOEX is defined to the addrinfoexW structure. When UNICODE or _UNICODE is not defined, FreeAddrInfoEx is defined to FreeAddrInfoExA, the ANSI version of the function, and ADDRINFOEX is defined to the addrinfoexA structure.

Windows 8.1 and Windows Server 2012 R2: The FreeAddrInfoExW function is supported for Windows Store apps on Windows 8.1, Windows Server 2012 R2, and later.


Minimum supported client Windows 8.1, Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header ws2tcpip.h
Library Ws2_32.lib
DLL Ws2_32.dll

See also