mirror of https://github.com/PCSX2/pcsx2.git
common: Call va_end after vfprintf in PluginLog
The C spec states that the va_arg argument value is indeterminate after returning from vfprintf. va_end and va_start must be called before the variable is reused.
This commit is contained in:
parent
ba1689f6d6
commit
fa7822fbbf
|
@ -86,37 +86,40 @@ struct PluginLog
|
|||
|
||||
void Write(const char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
|
||||
if (LogFile == NULL)
|
||||
return;
|
||||
|
||||
va_start(list, fmt);
|
||||
if (WriteToFile)
|
||||
va_list list;
|
||||
if (WriteToFile) {
|
||||
va_start(list, fmt);
|
||||
vfprintf(LogFile, fmt, list);
|
||||
if (WriteToConsole)
|
||||
va_end(list);
|
||||
}
|
||||
if (WriteToConsole) {
|
||||
va_start(list, fmt);
|
||||
vfprintf(stdout, fmt, list);
|
||||
va_end(list);
|
||||
va_end(list);
|
||||
}
|
||||
}
|
||||
|
||||
void WriteLn(const char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
|
||||
if (LogFile == NULL)
|
||||
return;
|
||||
|
||||
va_start(list, fmt);
|
||||
if (WriteToFile)
|
||||
va_list list;
|
||||
if (WriteToFile) {
|
||||
va_start(list, fmt);
|
||||
vfprintf(LogFile, fmt, list);
|
||||
if (WriteToConsole)
|
||||
vfprintf(stdout, fmt, list);
|
||||
va_end(list);
|
||||
|
||||
if (WriteToFile)
|
||||
va_end(list);
|
||||
fprintf(LogFile, "\n");
|
||||
if (WriteToConsole)
|
||||
}
|
||||
if (WriteToConsole) {
|
||||
va_start(list, fmt);
|
||||
vfprintf(stdout, fmt, list);
|
||||
va_end(list);
|
||||
fprintf(stdout, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(_MSC_VER) || !defined(UNICODE)
|
||||
|
|
Loading…
Reference in New Issue