fix: Move buffer initialization to set config

When calling set config message buffers were not affected because the
creation was handled on init.

Closes https://github.com/espressif/esp-mqtt/issues/267
This commit is contained in:
Euripedes Rocha
2023-09-14 14:00:42 +02:00
committed by Rocha Euripedes
parent abd8b6cadc
commit ea0df31e00
4 changed files with 30 additions and 22 deletions
+1
View File
@@ -100,6 +100,7 @@
#define MQTT_ENABLE_SSL CONFIG_MQTT_TRANSPORT_SSL
#define MQTT_ENABLE_WS CONFIG_MQTT_TRANSPORT_WEBSOCKET
#define MQTT_ENABLE_WSS CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE
#define MQTT_DEFAULT_RETRANSMIT_TIMEOUT_MS 1000
#ifdef CONFIG_MQTT_EVENT_QUEUE_SIZE
#define MQTT_EVENT_QUEUE_SIZE CONFIG_MQTT_EVENT_QUEUE_SIZE
+1 -1
View File
@@ -618,7 +618,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));
memset(&connection->outbound_message, 0, sizeof(mqtt_message_t));
connection->buffer = (uint8_t *)calloc(buffer_size, sizeof(uint8_t));
if (!connection->buffer) {
return ESP_ERR_NO_MEM;