diff options
-rw-r--r-- | src/til_str.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/til_str.c b/src/til_str.c index 442e923..f3cc5e8 100644 --- a/src/til_str.c +++ b/src/til_str.c @@ -88,14 +88,15 @@ til_str_t * til_str_newf(const char *format, ...) assert(format); - va_start(ap, format); + va_start(ap, format); str = til_str_nulstr(vsnprintf(NULL, 0, format, ap) + 1); + va_end(ap); if (!str) return NULL; + va_start(ap, format); str->size.used += vsnprintf(str->buf, str->size.allocated, format, ap); - va_end(ap); assert(str->size.used <= str->size.allocated); |