'\"macro stdmacro
.if n .pH g3n.t_free @(#)t_free	40.4 of 10/10/89
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} t_free 3N "Networking Support Utilities" "\&"
.if \nX=1 .ds x} t_free 3N "Networking Support Utilities"
.if \nX=2 .ds x} t_free 3N "" "\&"
.if \nX=3 .ds x} t_free "" "" "\&"
.if \nX=4 .ds x} t_free "NS_LIB" "EXTENSION" " "
.TH \*(x}
.SH NAME
\f4t_free\f1 \- free a library structure
.SH SYNOPSIS
\f4#include <tiuser.h>\f1
.PP
\f4int t_free(ptr, struct_type)\f1
.br
\f4char *ptr;\f1
.br
\f4int struct_type;\f1
.SH DESCRIPTION
The \f4t_free\fP function frees memory previously allocated by
\f4t_alloc\fP.
This function will free memory for the specified structure, and
will also free memory for buffers referenced by the structure.
.PP
\f4ptr\fP points to one of the six structure types described for
\f4t_alloc\fP, and \f4struct_type\fP identifies the type of that
structure, which can be one of the following:
.TP 17
\f4T_BIND\fP
\f4struct t_bind\fP
.TP
\f4T_CALL\fP
\f4struct t_call\fP
.TP
\f4T_OPTMGMT\fP
\f4struct t_optmgmt\fP
.TP
\f4T_DIS\fP
\f4struct t_discon\fP
.TP
\f4T_UNITDATA\fP
\f4struct t_unitdata\fP
.TP
\f4T_UDERROR\fP
\f4struct t_uderr\fP
.TP
\f4T_INFO\fP
\f4struct t_info\fP
.PP
where each of these structures is used as an argument to one or
more transport functions.
.PP
\f4t_free\fP will check the \f4addr\fP, \f4opt\fP, and \f4udata\fP
fields of the given structure (as appropriate), and free the
buffers pointed to by the \f4buf\fP field of the \f4netbuf\fP
[see \f4intro\fP(3)] structure.
If \f4buf\fP is \s-1NULL\s+1, \f4t_free\fP will not attempt to free memory.
After all buffers are freed, \f4t_free\fP will free the memory
associated with the structure pointed to by \f4ptr\fP.
.PP
Undefined results will occur if \f4ptr\fP or any of the \f4buf\fP
pointers points to a block of memory that was not previously
allocated by \f4t_alloc\fP.
.P
On failure, \f4t_errno\f1 may be set to the following:
.TP 15
\f4[TSYSERR]\fP
A system error has occurred during execution of this function.
.SH SEE ALSO
\f4intro\fP(3), \f4t_alloc\fP(3N).
.sp .2
\f2UNIX System V Network Programmer's Guide\f1.
.SH DIAGNOSTICS
\f4t_free\fP returns 0 on success and \-1 on failure and
\f4t_errno\f1 is set to indicate the error.
.Ee
