FreeAddrInfo Function (Winsock)

The FreeAddrInfo function frees memory that was allocated by a previous call to the GetAddrInfo function.

void FreeAddrInfo( _Inout_ PADDRINFOA pAddrInfo );
void FreeAddrInfo( _Inout_ PADDRINFOW pAddrInfo );

Syntax


// For ANSI strings
DWORD FreeAddrInfoA(
  _Inout_ PADDRINFOA pAddrInfo
);

// For Unicode strings
DWORD FreeAddrInfoW(
  _Inout_ PADDRINFOW pAddrInfo
);
            

Parameters

pAddrInfo [in, out]
A pointer to the linked list of ADDRINFO structures to be freed. This pointer is returned by a previous call to the GetAddrInfo function.

Return Value

This function does not return a value.

Remarks

The FreeAddrInfo function is used to release the memory allocated by GetAddrInfo. It's crucial to call this function after you are finished with the address information returned by GetAddrInfo to prevent memory leaks.

The GetAddrInfo function can allocate multiple ADDRINFO structures in a linked list. FreeAddrInfo iterates through this list and frees each structure.

It is safe to pass NULL to FreeAddrInfo; the function will simply return without doing anything.

Requirements

Package Header Library
Windows SDK winsock2.h Ws2_32.lib

See Also