|
Description
The user calls the t_free() function to release memory which was previously assigned with the t_alloc() function. t_free() releases the memory for the object of type struct_type to which pointer ptr points.
struct_type specifies one of the six structure types described for t_alloc():
T_BIND (for struct t_bind)
T_CALL (for struct t_call)
T_OPTMGMT (for struct t_optmgmt)
T_DIS (for struct t_discon)
T_UNITDATA (for struct t_unitdata)
T_UDERROR (for struct t_uderr)
T_INFO (for struct t_info)
The t_free() function checks the ptr->addr, ptr->opt and ptr->udata components of type struct netbuf in the struct_type *ptr object and releases the buffer to which the buf component of the separate netbuf structures point. If a buf pointer is the null pointer, t_free() does not try to release the memory involved. As soon as all buf buffers are released, t_free() releases the structure to which ptr points.
t_free() produces undefined results if ptr or any buf pointer points to a memory area which was not previously reserved with t_alloc().
Return value
0:
If successful.
-1:
If an error occurs. t_ errno is set to indicate the error.
Errors
TSYSERR
A system error occurred during execution of this function.