Export (0) Print
Expand All
Expand Minimize

freeaddrinfo function

The freeaddrinfo function frees address information that the getaddrinfo function dynamically allocates in addrinfo structures.

Syntax


void freeaddrinfo(
  _In_  struct addrinfo *ai
);

Parameters

ai [in]

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

Return value

This function does not return a value.

Remarks

The freeaddrinfo function frees addrinfo structures dynamically allocated by the ANSI getaddrinfo function. The freeaddrinfo function frees the initial addrinfo structure pointed to in the ai parameter, including any buffers to which structure members point, then continues freeing any addrinfo structures linked by the ai_next member of the addrinfo structure. The freeaddrinfo 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 ai parameter of a pointer of type ADDRINFOT. 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. 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.

Support for freeaddrinfo on earlier versions of Windows

The freeaddrinfo function was added to the Ws2_32.dll on Windows XP and later.

The FreeAddrInfoW function is the Unicode version of freeaddrinfo. The FreeAddrInfoW function was added to the Ws2_32.dll in Windows XP with Service Pack 2 (SP2). The FreeAddrInfoW function cannot be used on versions of Windows earlier than Windows XP with SP2.

Windows Phone 8: The freeaddrinfo function is supported for Windows Phone Store apps on Windows Phone 8 and later.

Windows 8.1 and Windows Server 2012 R2: The freeaddrinfo and FreeAddrInfoW functions are supported for Windows Store apps on Windows 8.1, Windows Server 2012 R2, and later.

Requirements

Minimum supported client

Windows 8.1, Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Minimum supported phone

Windows Phone 8

Header

Ws2tcpip.h

DLL

Ws2_32.dll

See also

addrinfo
addrinfoW
FreeAddrInfoW
getaddrinfo
GetAddrInfoW
Winsock Functions

 

 

Community Additions

ADD
Show:
© 2014 Microsoft