aboutsummaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-10-05 22:06:06 +0200
committerMarc André Tanner <mat@brain-dump.org>2016-10-05 22:06:06 +0200
commitfc575f6986d19205a3b97f1813246529c6d2fc79 (patch)
tree73f14c6bae1306f9510f95579438d18fcaf01754 /buffer.c
parente3c1f30e6d8dc15b35842d847f87954b4aa046e0 (diff)
downloadvis-fc575f6986d19205a3b97f1813246529c6d2fc79.tar.gz
vis-fc575f6986d19205a3b97f1813246529c6d2fc79.tar.xz
Fix various issues reported by coverity scan
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/buffer.c b/buffer.c
index abf3ab7..f483d53 100644
--- a/buffer.c
+++ b/buffer.c
@@ -118,8 +118,10 @@ bool buffer_vprintf(Buffer *buf, const char *fmt, va_list ap) {
va_list ap_save;
va_copy(ap_save, ap);
int len = vsnprintf(NULL, 0, fmt, ap);
- if (len == -1 || !buffer_grow(buf, len+1))
+ if (len == -1 || !buffer_grow(buf, len+1)) {
+ va_end(ap_save);
return false;
+ }
bool ret = vsnprintf(buf->data, len+1, fmt, ap_save) == len;
if (ret)
buf->len = len+1;