diff options
| author | Raúl Peñacoba <raul.mikaop.zelda@gmail.com> | 2017-03-31 21:36:06 +0200 |
|---|---|---|
| committer | Raúl Peñacoba <raul.mikaop.zelda@gmail.com> | 2017-03-31 21:36:06 +0200 |
| commit | 474365647cc7f65da26301b312e5fdee527c56bf (patch) | |
| tree | 5e9ab8b237dbf05b31e551740541690b4ca5dfce | |
| parent | c5594e156e6088c791060f5a4839b89f0906d4d1 (diff) | |
| download | vis-474365647cc7f65da26301b312e5fdee527c56bf.tar.gz vis-474365647cc7f65da26301b312e5fdee527c56bf.tar.xz | |
text: Add missing va_end() when
vsnprintf fails
| -rw-r--r-- | text.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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); |
