vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 8c0b43956056e12626e27ac09fd5eec4fd2597be parent f2ed4c185da4bce601f44349364ca97297e6a968 Author: Raúl Peñacoba <raul.mikaop.zelda@gmail.com> Date: Fri, 31 Mar 2017 21:36:06 +0200 text: Add missing va_end() when vsnprintf fails Diffstat:
| M | text.c | | | 4 | +++- |
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git 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);