From: Zdenek Kabelac Date: Tue, 23 Nov 2010 15:08:57 +0000 (+0000) Subject: Move va_end() so it is also used before error path return X-Git-Tag: v2_02_78~53 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=0eb26e4582f584c542e982ed12908889a799f8ca;p=lvm2.git Move va_end() so it is also used before error path return --- diff --git a/lib/config/config.c b/lib/config/config.c index 2b386634a..c10c78ec6 100644 --- a/lib/config/config.c +++ b/lib/config/config.c @@ -381,11 +381,12 @@ static int _line_append(struct output_line *outline, const char *fmt, ...) va_start(ap, fmt); n = vsnprintf(&buf[0], sizeof buf - 1, fmt, ap); + va_end(ap); + if (n < 0 || n > (int) sizeof buf - 1) { log_error("vsnprintf failed for config line"); return 0; } - va_end(ap); if (!dm_pool_grow_object(outline->mem, &buf[0], strlen(buf))) { log_error("dm_pool_grow_object failed for config line");