VFS: Fix memory access after free() in UART select()
Closes https://github.com/espressif/esp-idf/issues/4030
This commit is contained in:
parent
dbf2c3d480
commit
63c2834d7b
1 changed files with 4 additions and 4 deletions
|
@ -474,10 +474,6 @@ static esp_err_t uart_end_select(void *end_select_args)
|
||||||
{
|
{
|
||||||
uart_select_args_t *args = end_select_args;
|
uart_select_args_t *args = end_select_args;
|
||||||
|
|
||||||
if (args) {
|
|
||||||
free(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
portENTER_CRITICAL(uart_get_selectlock());
|
portENTER_CRITICAL(uart_get_selectlock());
|
||||||
esp_err_t ret = unregister_select(args);
|
esp_err_t ret = unregister_select(args);
|
||||||
for (int i = 0; i < UART_NUM; ++i) {
|
for (int i = 0; i < UART_NUM; ++i) {
|
||||||
|
@ -485,6 +481,10 @@ static esp_err_t uart_end_select(void *end_select_args)
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL(uart_get_selectlock());
|
portEXIT_CRITICAL(uart_get_selectlock());
|
||||||
|
|
||||||
|
if (args) {
|
||||||
|
free(args);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue