From 6c849c62ef2789f7fbd9a4e048415d1c61591f05 Mon Sep 17 00:00:00 2001 From: Euripedes Rocha Date: Wed, 21 Jun 2023 08:23:24 +0200 Subject: [PATCH] Fix: Allocation for connection buffer was incorrectly done. By mistake calloc parameters were incorrect. --- lib/mqtt_msg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mqtt_msg.c b/lib/mqtt_msg.c index 781bbea..4e9a2f4 100644 --- a/lib/mqtt_msg.c +++ b/lib/mqtt_msg.c @@ -619,7 +619,7 @@ int mqtt_has_valid_msg_hdr(uint8_t *buffer, size_t length) esp_err_t mqtt_msg_buffer_init(mqtt_connection_t *connection, int buffer_size) { memset(connection, 0, sizeof(mqtt_connection_t)); - connection->buffer = (uint8_t *)calloc(0, buffer_size); + connection->buffer = (uint8_t *)calloc(buffer_size, sizeof(uint8_t)); if (!connection->buffer) { return ESP_ERR_NO_MEM; }