int t_free (ptr, struct_type)
char *ptr;
int struct_type;
XTI syntax
cc . . . -lxti
#include <xti.h>
int t_free (ptr, struct_type)
char *ptr;
int struct_type;
Description
The t_free function frees memory previously allocated by
t_alloc.
This function frees memory for the specified structure and
also frees memory for buffers referenced by the structure.
ptr points to one of the six structure types described for
t_alloc, and struct_type
identifies the type of that structure which can be one
of the following, where each of these structures is used
as an argument to one or more transport functions.
struct_type
struct
T_BIND
T_BIND_STR
t_bind
T_CALL
T_CALL_STR
t_call
T_DIS
T_DIS_STR
t_discon
T_INFO
T_INFO_STR
t_info
T_OPTMGMT
T_OPTMGMT_STR
t_optmgmt
T_UDERROR
T_UDERROR_STR
t_uderr
T_UNITDATA
T_UNITDATA_STR
t_unitdata
The t_free function checks the addr,
opt, and udata fields of the given structure
(as appropriate) and frees the buffers pointed to by the
buf field of the netbuf (see
netbuf(FP))
structure.
If buf is NULL, t_free
does not attempt to free memory.
After all buffers are freed, t_free
frees the memory associated with the structure pointed to by
ptr.
Undefined results occur if ptr or any of the buf
pointers points to a block of memory that was not previously
allocated by t_alloc.
Return values
t_free
returns 0 on success and -1 on failure, and
t_errno is set to indicate the error.
Diagnostics
On failure, t_errno may be set to the following:
[TNOSTRUCTYPE]
struct_type is out of the range.
This error code only occurs with XTI.
[TSYSERR]
A system error has occurred during execution of this function.
For TLI, this error code is also returned when
struct_type is out of range; when this error occurs,
errno is set to EINVAL.