Skip to content

Commit 00ee059

Browse files
fix: Uses caps allocation for data buffer instead of item struct
Once introduced the memory destination for outbox was incorrectly allocating the outbox data structuture instead of data buffer to the selected memory.
1 parent 05b3476 commit 00ee059

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/mqtt_outbox.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ outbox_handle_t outbox_init(void)
4141

4242
outbox_item_handle_t outbox_enqueue(outbox_handle_t outbox, outbox_message_handle_t message, outbox_tick_t tick)
4343
{
44-
outbox_item_handle_t item = heap_caps_calloc(1, sizeof(outbox_item_t), MQTT_OUTBOX_MEMORY);
44+
outbox_item_handle_t item = calloc(1, sizeof(outbox_item_t));
4545
ESP_MEM_CHECK(TAG, item, return NULL);
4646
item->msg_id = message->msg_id;
4747
item->msg_type = message->msg_type;
4848
item->msg_qos = message->msg_qos;
4949
item->tick = tick;
5050
item->len = message->len + message->remaining_len;
5151
item->pending = QUEUED;
52-
item->buffer = malloc(message->len + message->remaining_len);
52+
item->buffer = heap_caps_malloc(message->len + message->remaining_len, MQTT_OUTBOX_MEMORY);
5353
ESP_MEM_CHECK(TAG, item->buffer, {
5454
free(item);
5555
return NULL;

0 commit comments

Comments
 (0)