Skip to content

Commit 6c849c6

Browse files
Fix: Allocation for connection buffer was incorrectly done.
By mistake calloc parameters were incorrect.
1 parent ee3ea29 commit 6c849c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/mqtt_msg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ int mqtt_has_valid_msg_hdr(uint8_t *buffer, size_t length)
619619
esp_err_t mqtt_msg_buffer_init(mqtt_connection_t *connection, int buffer_size)
620620
{
621621
memset(connection, 0, sizeof(mqtt_connection_t));
622-
connection->buffer = (uint8_t *)calloc(0, buffer_size);
622+
connection->buffer = (uint8_t *)calloc(buffer_size, sizeof(uint8_t));
623623
if (!connection->buffer) {
624624
return ESP_ERR_NO_MEM;
625625
}

0 commit comments

Comments
 (0)