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:
parent
e20068cb4a
commit
1a8acd3292
|
@ -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);
|
len = vsnprintf(buf->s + buf->len, buf->size - buf->len, fmt, args);
|
||||||
if (unlikely(len < 0))
|
if (unlikely(len < 0))
|
||||||
|
{
|
||||||
|
va_end(ap);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (len >= buf->size - buf->len)
|
if (len >= buf->size - buf->len)
|
||||||
{
|
{
|
||||||
buffer_ensure(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->len += len;
|
||||||
buf->s[buf->len] = '\0';
|
buf->s[buf->len] = '\0';
|
||||||
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue