mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
binpac: Add missing va_end()'s to match va_start()'s.
Probably not an issue on most implementations, but undefined behavior is scary and it's easy to fix.
This commit is contained in:
parent
cb524c2fde
commit
5e0f604418
1 changed files with 28 additions and 3 deletions
|
@ -41,7 +41,21 @@ int Output::print(const char* fmt, ...)
|
|||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
return print(fmt, ap);
|
||||
int r = -1;
|
||||
|
||||
try
|
||||
{
|
||||
r = print(fmt, ap);
|
||||
}
|
||||
|
||||
catch ( ... )
|
||||
{
|
||||
va_end(ap);
|
||||
throw;
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
return r;
|
||||
}
|
||||
|
||||
int Output::println(const char* fmt, ...)
|
||||
|
@ -49,11 +63,22 @@ int Output::println(const char* fmt, ...)
|
|||
for ( int i = 0; i < indent(); ++i )
|
||||
fprintf(fp, "\t");
|
||||
|
||||
int r;
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
r = print(fmt, ap);
|
||||
int r = -1;
|
||||
|
||||
try
|
||||
{
|
||||
r = print(fmt, ap);
|
||||
}
|
||||
|
||||
catch ( ... )
|
||||
{
|
||||
va_end(ap);
|
||||
throw;
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
fprintf(fp, "\n");
|
||||
return r;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue