mirror of https://github.com/mkerrisk/man-pages
printf.3: Fix a small bug in example code
Move the second call to va_end(ap) to above the if-block that precedes it, so that the va_list 'ap' will be cleaned up in all cases. Reported-by: Erik Roland van der Meer <ervdmeer@gmail.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
5d048f53d3
commit
1ed246aedd
|
@ -1157,11 +1157,12 @@ make_message(const char *fmt, ...)
|
|||
|
||||
va_start(ap, fmt);
|
||||
size = vsnprintf(p, size, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (size < 0) {
|
||||
free(p);
|
||||
return NULL;
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue