From 474365647cc7f65da26301b312e5fdee527c56bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Pe=C3=B1acoba?= Date: Fri, 31 Mar 2017 21:36:06 +0200 Subject: text: Add missing va_end() when vsnprintf fails --- text.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'text.c') diff --git a/text.c b/text.c index d424cad..f5f5a43 100644 --- a/text.c +++ b/text.c @@ -640,8 +640,10 @@ static bool text_vprintf(Text *txt, size_t pos, const char *format, va_list ap) va_list ap_save; va_copy(ap_save, ap); int len = vsnprintf(NULL, 0, format, ap); - if (len == -1) + if (len == -1) { + va_end(ap_save); return false; + } char *buf = malloc(len+1); bool ret = buf && (vsnprintf(buf, len+1, format, ap_save) == len) && text_insert(txt, pos, buf, len); free(buf); -- cgit v1.2.3