Share this page

# lrs_free_buffer

Buffer Functions

Frees the memory allocated for a buffer.

    int lrs_free_buffer( char *buffer );

buffer | A pointer to a buffer.

The lrs_free_buffer function frees the memory allocated for the specified buffer. The memory is allocated when you call the lrs_get_buffer_by_name or lrs_get_last_received_buffer functions.

CAUTION: Only use this function for freeing memory allocated by lrs_get_buffer_by_name or lrs_get_last_received_buffer. Do not use this function to free memory allocated by other functions.

This function is not recorded during a WinSock session; you must insert it into your script manually. After you retrieve a buffer using lrs_get_buffer_by_name or lrs_get_last_received_buffer, you should free the allocated memory using lrs_free_buffer, provided that you no longer need the buffer.

## Return Values

Windows Sockets Return Values

## Parameterization

You cannot use standard parameterization for any arguments in this function.

## Example

In the following example, lrs_free_buffer frees the buffer.

Copy code

    char *ActualBuffer;
    int NumberOfBytes;
    lrs_receive("socket2", "buf20", LrsLastArg);
    /* Get the size and location of the data within the buffer. */
    lrs_get_last_received_buffer("socket2", &ActualBuffer, &NumberOfBytes);
    lr_output_message("The last buffer contains:%s\n", ActualBuffer);
    lr_output_message("The last buffer's size is:%d\n", NumberOfBytes);
    lrs_free_buffer(ActualBuffer);

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: