Statically allocate UART Receive buffers by Max-Plastix · Pull Request #248 · HelTecAutomation/CubeCell-Arduino · GitHub
Skip to content

Statically allocate UART Receive buffers#248

Merged
Quency-D merged 1 commit into
HelTecAutomation:masterfrom
Max-Plastix:static-uart-buffer
Sep 19, 2022
Merged

Statically allocate UART Receive buffers#248
Quency-D merged 1 commit into
HelTecAutomation:masterfrom
Max-Plastix:static-uart-buffer

Conversation

@Max-Plastix

Copy link
Copy Markdown
Contributor

The existing dynamic UART receive buffer allocation has problematic issues. The malloc() may fail, and the code proceeds with a null buffer. Earlier code failed to free() and ran out of memory.
The current code frees the receive buffer while Rx interrupts are still enabled, causing use-after-free.

For these two fixed-size UART buffers, dynamic allocation is not needed and the code is better served by static allocation.

@Quency-D Quency-D merged commit 2300ef2 into HelTecAutomation:master Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants