mirror of
https://github.com/espressif/esp-mqtt.git
synced 2025-07-30 02:38:19 +02:00
Merge branch 'bugfix/connection_buffer_allocation' into 'master'
Fix: Allocation for connection buffer was incorrectly done. See merge request espressif/esp-mqtt!182
This commit is contained in:
@ -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)
|
esp_err_t mqtt_msg_buffer_init(mqtt_connection_t *connection, int buffer_size)
|
||||||
{
|
{
|
||||||
memset(connection, 0, sizeof(mqtt_connection_t));
|
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) {
|
if (!connection->buffer) {
|
||||||
return ESP_ERR_NO_MEM;
|
return ESP_ERR_NO_MEM;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user