# mspReleaseBuffer

Returns an event buffer to the MSPP API.

#### Prototype

DWORD mspReleaseBuffer ( MSPHD msphd, void *buffer )

Argument | Description
msphd | MSPP handle associated with the channel or endpoint that sent the data buffer.
buffer | Pointer to the address of the buffer to release.

#### Return values

Return value | Description
SUCCESS |
CTAERR_BAD_ARGUMENT | Function argument includes an invalid value or a required pointer argument is NULL.
CTAERR_INVALID_CTAHD | Handle is invalid.
CTAERR_INVALID_HANDLE | Invalid handle was passed as an argument to this function.
MSPERR_DRIVER_COMMAND_FAILED | SPI command has failed.
MSPERR_ENDPOINT_NOT_ALLOCATED | MSPP endpoint is defined, but not yet allocated on the board.
MSPERR_INVALID_HANDLE | Specified MSPP endpoint/channel is not valid.

#### Events

None.

#### Details

This function returns retrieved event buffers so the application can reuse them.

The following restrictions apply to mspReleaseBuffer:

- If an application uses an endpoint or a channel with an attached buffer but does not return the buffer (through mspReleaseBuffer), the number of events the applications receives is limited to ten. Subsequent events are dropped.

- Calling mspReleaseBuffer twice for the same buffer creates an access violation.

#### See also

mspSendQuery, mspSendCommand

#### Example

if(Event.size != 0 && Event.buffer != NULL )
{
ret = mspReleaseBuffer( Event.objHd, Event.buffer);
Event.buffer = NULL;
Event.size = 0;
if ( ret != SUCCESS)
return FAILURE;
}