According to the stdarg(3) man page each invocation of va_copy()
should be paired with an invocation of va_end().
Cc: Erwan Velu <erwanaliasr1@gmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
char *newbuf;
newbuf = realloc(buf->buf, newsize);
- if (!newbuf)
- return -1;
+ if (!newbuf) {
+ rv = -1;
+ goto bail;
+ }
buf->buf = newbuf;
buf->size = newsize;
rv = vsnprintf(buf->buf + buf->len, buf->size - buf->len, format, ap2);
buf->len += rv;
+bail:
+ va_end(ap2);
return rv;
}