Unverified Commit 4da10512 authored by Andreas Merkle's avatar Andreas Merkle Committed by GitHub

Bugfix of the following problems: Invalid variable argument list used to...

Bugfix of the following problems: Invalid variable argument list used to retrieve length. If length is greater or equal than the available buffer, a memory leak will happen because va_end() is missing. (#6360)
parent 7d4992a8
......@@ -421,11 +421,12 @@ int log_printf(const char *format, ...)
va_list copy;
va_start(arg, format);
va_copy(copy, arg);
len = vsnprintf(NULL, 0, format, arg);
len = vsnprintf(NULL, 0, format, copy);
va_end(copy);
if(len >= sizeof(loc_buf)){
temp = (char*)malloc(len+1);
if(temp == NULL) {
va_end(arg);
return 0;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment