From a287bbc25e127510c86c316a791cffc59146bbb5 Mon Sep 17 00:00:00 2001 From: Yogesh Mantri Date: Wed, 9 Sep 2026 18:48:49 +0800 Subject: [PATCH] fix(console): delete state_mux when REPL creation fails --- components/console/esp_console_common.c | 4 ++++ components/console/esp_console_repl_chip.c | 4 ++++ 2 files changed, 8 insertions(+) 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) {