Skip to content

Commit dd72141

Browse files
committed
fix(uart): add check for malloc in uart examples
Closes #13405
1 parent b5587f0 commit dd72141

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

examples/peripherals/uart/uart_echo_rs485/main/rs485_example.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ static void echo_task(void *arg)
9494

9595
// Allocate buffers for UART
9696
uint8_t* data = (uint8_t*) malloc(BUF_SIZE);
97+
assert(data);
9798

9899
ESP_LOGI(TAG, "UART start receive loop.\r");
99100
echo_send(uart_num, "Start RS485 UART test.\r\n", 24);

examples/peripherals/uart/uart_events/main/uart_events_example_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ static void uart_event_task(void *pvParameters)
4141
uart_event_t event;
4242
size_t buffered_size;
4343
uint8_t* dtmp = (uint8_t*) malloc(RD_BUF_SIZE);
44+
assert(dtmp);
4445
for (;;) {
4546
//Waiting for UART event.
4647
if (xQueueReceive(uart0_queue, (void *)&event, (TickType_t)portMAX_DELAY)) {

0 commit comments

Comments
 (0)