lib/talloc: Avoid early exit before va_end()
authorSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Fri, 18 Dec 2015 03:04:15 +0000 (14:04 +1100)
committerSam Mendoza-Jonas <sam@mendozajonas.com>
Tue, 9 Feb 2016 02:39:34 +0000 (13:39 +1100)
Fixes Coverity defect #30486

Signed-off-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
lib/talloc/talloc.c

index fa34323104a23a6e252d4d5c1ab9c7965d9c4ad0..f2335410eac65a812c50103b957daa1a522cdc05 100644 (file)
@@ -1032,13 +1032,15 @@ static char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap)
        len = vsnprintf(NULL, 0, fmt, ap2);
 
        s = talloc_realloc(NULL, s, char, s_len + len+1);
-       if (!s) return NULL;
+       if (!s)
+               goto out;
 
        VA_COPY(ap2, ap);
 
        vsnprintf(s+s_len, len+1, fmt, ap2);
        talloc_set_name_const(s, s);
 
+out:
        va_end(ap2);
        return s;
 }