Open System Services Library Calls Reference Manual (G06.28+, H06.05+)
OSS Library Calls (e - f) freeaddrinfo(3)
NAME
freeaddrinfo - Frees address information structure and storage for IPv6 socket
LIBRARY
G-series native OSS processes: /G/system/sysnn/zinetsrl
H-series OSS processes: /G/system/zdllnnn/zinetdll
SYNOPSIS
#include <netdb.h>
void freeaddrinfo(
struct addrinfo *ai);
PARAMETERS
ai Specifies the address information structure to be freed
DESCRIPTION
The freeaddrinfo() function frees a specified address information structure previously created
by the getaddrinfo( ) function. Any dynamic storage pointed to by the structure is also freed.
NOTES
Call this function once for each structure created by calls to getaddrinfo() before closing a
socket.
EXAMPLES
.
.
.
struct addrinfo *res;
struct addrinfo *aip;
.
.
.
for (aip = res; aip !=NULL; aip = aip->ai_next){
/*
* create a socket, address type depends
* on getaddrinfo() returned value */
sock=socket(aip->ai_family, aip->ai_socktype, aip->ai_protocol);
if (sock == -1) {
perror("socket");
freaddrinfo(res);
return(-1);
}
}
RETURN VALUES
Upon successful completion, this function does not return a value. The address information
structure and associated storage have been returned to the system. Otherwise, an invalid address
reference causes application failure and results in a signal.
ERRORS
This function does not set errno.
527187-007 Hewlett-Packard Company 2−97