forked from espressif/esp-idf
fix(uart): add check for malloc in uart examples
Closes https://github.com/espressif/esp-idf/issues/13405
This commit is contained in:
@@ -94,6 +94,7 @@ static void echo_task(void *arg)
|
|||||||
|
|
||||||
// Allocate buffers for UART
|
// Allocate buffers for UART
|
||||||
uint8_t* data = (uint8_t*) malloc(BUF_SIZE);
|
uint8_t* data = (uint8_t*) malloc(BUF_SIZE);
|
||||||
|
assert(data);
|
||||||
|
|
||||||
ESP_LOGI(TAG, "UART start receive loop.\r");
|
ESP_LOGI(TAG, "UART start receive loop.\r");
|
||||||
echo_send(uart_num, "Start RS485 UART test.\r\n", 24);
|
echo_send(uart_num, "Start RS485 UART test.\r\n", 24);
|
||||||
|
@@ -41,6 +41,7 @@ static void uart_event_task(void *pvParameters)
|
|||||||
uart_event_t event;
|
uart_event_t event;
|
||||||
size_t buffered_size;
|
size_t buffered_size;
|
||||||
uint8_t* dtmp = (uint8_t*) malloc(RD_BUF_SIZE);
|
uint8_t* dtmp = (uint8_t*) malloc(RD_BUF_SIZE);
|
||||||
|
assert(dtmp);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
//Waiting for UART event.
|
//Waiting for UART event.
|
||||||
if (xQueueReceive(uart0_queue, (void *)&event, (TickType_t)portMAX_DELAY)) {
|
if (xQueueReceive(uart0_queue, (void *)&event, (TickType_t)portMAX_DELAY)) {
|
||||||
|
Reference in New Issue
Block a user