Add missing va_end()s to buffer_addvf()

Not only does every va_start() need a corresponding va_end(), this is
also true for va_end(). Thus, buffer_addvf() needs to call va_end().

Found by Codacy.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2017-11-17 10:23:11 +01:00
parent e20068cb4a
commit 1a8acd3292
1 changed files with 4 additions and 0 deletions

View File

@ -81,7 +81,10 @@ buffer_addvf(buffer_t *buf, const char *fmt, va_list args)
len = vsnprintf(buf->s + buf->len, buf->size - buf->len, fmt, args);
if (unlikely(len < 0))
{
va_end(ap);
return;
}
if (len >= buf->size - buf->len)
{
buffer_ensure(buf, len);
@ -89,6 +92,7 @@ buffer_addvf(buffer_t *buf, const char *fmt, va_list args)
}
buf->len += len;
buf->s[buf->len] = '\0';
va_end(ap);
}
void