diff --git a/cores/esp32/HWCDC.cpp b/cores/esp32/HWCDC.cpp index 25744f0b0a3..6ec8625cff9 100644 --- a/cores/esp32/HWCDC.cpp +++ b/cores/esp32/HWCDC.cpp @@ -28,7 +28,7 @@ ESP_EVENT_DEFINE_BASE(ARDUINO_HW_CDC_EVENTS); static RingbufHandle_t tx_ring_buf = NULL; static xQueueHandle rx_queue = NULL; -static uint8_t rx_data_buf[64]; +static uint8_t rx_data_buf[64] = {0}; static intr_handle_t intr_handle = NULL; static volatile bool initial_empty = false; static xSemaphoreHandle tx_lock = NULL; @@ -195,6 +195,7 @@ void HWCDC::end() intr_handle = NULL; if(tx_lock != NULL) { vSemaphoreDelete(tx_lock); + tx_lock = NULL; } setRxBufferSize(0); setTxBufferSize(0);