From 70656aa129701114c1af05c70b8cba93846be960 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Wed, 9 Jan 2019 21:37:31 +0100 Subject: [PATCH] fix leak in log_printf --- cores/esp32/esp32-hal-uart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cores/esp32/esp32-hal-uart.c b/cores/esp32/esp32-hal-uart.c index 9e60d6be..b4442f75 100644 --- a/cores/esp32/esp32-hal-uart.c +++ b/cores/esp32/esp32-hal-uart.c @@ -481,7 +481,7 @@ int log_printf(const char *format, ...) vsnprintf(temp, len+1, format, arg); #if !CONFIG_DISABLE_HAL_LOCKS if(_uart_bus_array[s_uart_debug_nr].lock){ - while (xSemaphoreTake(_uart_bus_array[s_uart_debug_nr].lock, portMAX_DELAY) != pdPASS); + xSemaphoreTake(_uart_bus_array[s_uart_debug_nr].lock, portMAX_DELAY); ets_printf("%s", temp); xSemaphoreGive(_uart_bus_array[s_uart_debug_nr].lock); } else { @@ -491,7 +491,7 @@ int log_printf(const char *format, ...) ets_printf("%s", temp); #endif va_end(arg); - if(len > sizeof(loc_buf)){ + if(len >= sizeof(loc_buf)){ free(temp); } return len;