提交 70656aa1 编写于 作者: M me-no-dev

fix leak in log_printf

上级 fa61b3bf
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册