mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 03:08:46 +00:00
Can't use the same va_list twice, from Emanuele Giaquinta.
This commit is contained in:
parent
5339b8ce3a
commit
e9ebdac3dd
@ -44,12 +44,15 @@ int
|
||||
vasprintf(char **ret, const char *fmt, va_list ap)
|
||||
{
|
||||
int n;
|
||||
va_list ap2;
|
||||
|
||||
va_copy(ap2, ap);
|
||||
|
||||
if ((n = vsnprintf(NULL, 0, fmt, ap)) < 0)
|
||||
goto error;
|
||||
|
||||
*ret = xmalloc(n + 1);
|
||||
if ((n = vsnprintf(*ret, n + 1, fmt, ap)) < 0) {
|
||||
if ((n = vsnprintf(*ret, n + 1, fmt, ap2)) < 0) {
|
||||
xfree(*ret);
|
||||
goto error;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user