fix(uart): add check for malloc in uart examples

Closes https://github.com/espressif/esp-idf/issues/13405
This commit is contained in:
Song Ruo Jing
2025-04-03 22:23:18 +08:00
parent b5587f0b4f
commit dd72141b78
2 changed files with 2 additions and 0 deletions

View File

@@ -94,6 +94,7 @@ static void echo_task(void *arg)
// Allocate buffers for UART
uint8_t* data = (uint8_t*) malloc(BUF_SIZE);
assert(data);
ESP_LOGI(TAG, "UART start receive loop.\r");
echo_send(uart_num, "Start RS485 UART test.\r\n", 24);

View File

@@ -41,6 +41,7 @@ static void uart_event_task(void *pvParameters)
uart_event_t event;
size_t buffered_size;
uint8_t* dtmp = (uint8_t*) malloc(RD_BUF_SIZE);
assert(dtmp);
for (;;) {
//Waiting for UART event.
if (xQueueReceive(uart0_queue, (void *)&event, (TickType_t)portMAX_DELAY)) {