Skip to content

Commit 70656aa

Browse files
committed
fix leak in log_printf
1 parent fa61b3b commit 70656aa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: cores/esp32/esp32-hal-uart.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ int log_printf(const char *format, ...)
481481
vsnprintf(temp, len+1, format, arg);
482482
#if !CONFIG_DISABLE_HAL_LOCKS
483483
if(_uart_bus_array[s_uart_debug_nr].lock){
484-
while (xSemaphoreTake(_uart_bus_array[s_uart_debug_nr].lock, portMAX_DELAY) != pdPASS);
484+
xSemaphoreTake(_uart_bus_array[s_uart_debug_nr].lock, portMAX_DELAY);
485485
ets_printf("%s", temp);
486486
xSemaphoreGive(_uart_bus_array[s_uart_debug_nr].lock);
487487
} else {
@@ -491,7 +491,7 @@ int log_printf(const char *format, ...)
491491
ets_printf("%s", temp);
492492
#endif
493493
va_end(arg);
494-
if(len > sizeof(loc_buf)){
494+
if(len >= sizeof(loc_buf)){
495495
free(temp);
496496
}
497497
return len;

0 commit comments

Comments
 (0)