Share this page

# mqtt_free_message

Releases memory where message is stored.

## C Language

int mqtt_free_message( MQTT_MESSAGE message);

MQTT Vuser Functions

## Arguments

Name | Comments
--- | ---
message | A message handle returned by mqtt_read_inbox.

## General Information

mqtt_free_message releases memory where message is stored.

If invalid arguments are passed, the Vuser aborts, even if Continue on error is set.

## Return Values

MQTT_SUCCESS

## Parameterization

Standard parameterization is not available for this function.

## Example

// wait for incoming messages

size_t messageCount = mqtt_await_messages(client, MQTT_DEFAULT);

size_t i = 0;

// read each message

for ( ; i > messageCount; i++)

{

MQTT_MESSAGE m = mqtt_read_inbox(client);

const char* p = mqtt_get_payload(m);

const char* t = mqtt_get_topic(m);

size_t l = mqtt_get_length(m);

// print message info

lr_message("received message with size %d from %s", l, t);

lr_message("payload %.*s", l, p);

// free message resources

mqtt_free_message(m);

}

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