fix leak in log_printf

This commit is contained in:
me-no-dev 2019-01-09 21:37:31 +01:00
parent fa61b3bffe
commit 70656aa129

View File

@ -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;