FreeAddrInfoW function (ws2tcpip.h)

The FreeAddrInfoW function frees address information that the GetAddrInfoW function dynamically allocates in addrinfoW structures.

Syntax

VOID WSAAPI FreeAddrInfoW(
  [in] PADDRINFOW pAddrInfo
);

Parameters

[in] pAddrInfo

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

Return value

This function does not return a value.

Remarks

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

Macros in the Winsock header file define a mixed-case function name of FreeAddrInfo and an ADDRINFOT structure. This FreeAddrInfo function should be called with the pAddrInfo parameter of a pointer of type ADDRINFOT. When UNICODE or _UNICODE is defined, FreeAddrInfo is defined to FreeAddrInfoW, the Unicode version of the function, and ADDRINFOT is defined to the addrinfoW structure. When UNICODE or _UNICODE is not defined, FreeAddrInfo is defined to freeaddrinfo, the ANSI version of the function, and ADDRINFOT is defined to the addrinfo structure.

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

Note

The ws2tcpip.h header defines FreeAddrInfo as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

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

See also

GetAddrInfoW

Winsock Functions

addrinfo

addrinfoW

freeaddrinfo

getaddrinfo