From 1a8acd32928f9c7b3196c9c233ee54a985538a43 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Fri, 17 Nov 2017 10:23:11 +0100 Subject: [PATCH] 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 --- common/buffer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/buffer.c b/common/buffer.c index 2bff36042..cbdd3872a 100644 --- a/common/buffer.c +++ b/common/buffer.c @@ -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