Make PacketBuffer ringbuf be correct size

This commit is contained in:
Dan Halbert 2022-08-23 19:40:50 -04:00
parent 4a5790bb00
commit cf1d0e5e8f

View File

@ -300,7 +300,8 @@ void common_hal_bleio_packet_buffer_construct(
size_t incoming_buffer_size = 0;
uint32_t *incoming_buffer = NULL;
if (incoming) {
incoming_buffer_size = buffer_size * (sizeof(uint16_t) + max_packet_size);
// + 1 needed by ringbuf for empty/full detection.
incoming_buffer_size = buffer_size * (sizeof(uint16_t) + max_packet_size) + 1;
incoming_buffer = m_malloc(incoming_buffer_size, false);
}