Merge branch 'jk/bug-fl-va-list-fix'

Fix buggy va_list usage in recent code.

* jk/bug-fl-va-list-fix:
  bug_fl(): correctly initialize trace2 va_list
This commit is contained in:
Junio C Hamano 2022-06-17 10:33:32 -07:00
commit aa11b94ef8
2 changed files with 7 additions and 5 deletions

View file

@ -224,8 +224,8 @@ static int ut_009bug_BUG(int argc, const char **argv)
static int ut_010bug_BUG(int argc, const char **argv)
{
bug("a bug message");
BUG("a BUG message");
bug("a %s message", "bug");
BUG("a %s message", "BUG");
}
/*

View file

@ -334,15 +334,17 @@ NORETURN void BUG_fl(const char *file, int line, const char *fmt, ...)
int bug_called_must_BUG;
void bug_fl(const char *file, int line, const char *fmt, ...)
{
va_list ap, cp;
va_list ap;
bug_called_must_BUG = 1;
va_copy(cp, ap);
va_start(ap, fmt);
BUG_vfl_common(file, line, fmt, ap);
va_end(ap);
trace2_cmd_error_va(fmt, cp);
va_start(ap, fmt);
trace2_cmd_error_va(fmt, ap);
va_end(ap);
}
#ifdef SUPPRESS_ANNOTATED_LEAKS