Frees a library structure.
Transport Layer Interface Library (libtli.a)
#include <tiuser.h>
int t_free(ptr, struct_type)
char * ptr;
int struct_type;
The t_free subroutine frees memory previously allocated by the t_alloc subroutine. This subroutine frees memory for the specified structure and also frees memory for buffers referenced by the structure.
The t_free subroutine 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 structure. If the buf field is null, the t_free subroutine does not attempt to free memory. After all buffers are freed, the t_free subroutine frees the memory associated with the structure pointed to by the ptr parameter.
Undefined results will occur if the ptr parameter or any of the buf pointers points to a block of memory that was not previously allocated by the t_alloc subroutine.
Item | Description |
---|---|
ptr | Points to one of the seven structure types described for the t_alloc subroutine. |
struct_type | Identifies the type of that structure. The type can be one
of the following:
Each of these structure types is used as a parameter to one or more transport subroutines. |
On successful completion, the t_free subroutine returns a value of 0. Otherwise, it returns a value of -1, and the t_errno variable is set to indicate the error.
If unsuccessful, the t_errno variable is set to the following:
Value | Description |
---|---|
TNOSTRUCTYPE | Unsupported structure type requested. |
TSYSERR | A system error has occurred during execution of this function. |