diff --git a/components/console/esp_console_common.c b/components/console/esp_console_common.c index ac8dc65e7d2..cbd58f07b94 100644 --- a/components/console/esp_console_common.c +++ b/components/console/esp_console_common.c @@ -334,6 +334,10 @@ esp_err_t esp_console_new_repl_stdio(const esp_console_repl_config_t *repl_confi _exit: if (universal_repl) { esp_console_deinit(); + /* Only common_deinit() deletes state_mux, and the weak set_event_fd() never creates it. */ + if (universal_repl->repl_com.state_mux) { + vSemaphoreDelete(universal_repl->repl_com.state_mux); + } free(universal_repl); } if (ret_repl) { diff --git a/components/console/esp_console_repl_chip.c b/components/console/esp_console_repl_chip.c index b16c090ce33..cc3c42d9788 100644 --- a/components/console/esp_console_repl_chip.c +++ b/components/console/esp_console_repl_chip.c @@ -152,6 +152,10 @@ static esp_err_t esp_console_new_repl_uart_legacy(const esp_console_dev_uart_con _exit: if (uart_repl) { esp_console_deinit(); + /* Only common_deinit() deletes state_mux, and the weak set_event_fd() never creates it. */ + if (uart_repl->repl_com.state_mux) { + vSemaphoreDelete(uart_repl->repl_com.state_mux); + } free(uart_repl); } if (ret_repl) {