Skip to content

Commit

Permalink
fix leak in log_printf
Browse files Browse the repository at this point in the history
  • Loading branch information
me-no-dev committed Jan 9, 2019
1 parent fa61b3b commit 70656aa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cores/esp32/esp32-hal-uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
Expand Down

0 comments on commit 70656aa

Please sign in to comment.