diff options
-rw-r--r-- | source4/lib/talloc/talloc.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source4/lib/talloc/talloc.c b/source4/lib/talloc/talloc.c index d4c845fa88..92970426e8 100644 --- a/source4/lib/talloc/talloc.c +++ b/source4/lib/talloc/talloc.c @@ -1186,18 +1186,18 @@ char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) va_copy(ap2, ap); len = vsnprintf(&c, 1, fmt, ap2); va_end(ap2); - if (len < 0) { + if (unlikely(len < 0)) { return NULL; } ret = (char *)__talloc(t, len+1); - if (ret) { - va_copy(ap2, ap); - vsnprintf(ret, len+1, fmt, ap2); - va_end(ap2); - _talloc_set_name_const(ret, ret); - } + if (unlikely(!ret)) return NULL; + + va_copy(ap2, ap); + vsnprintf(ret, len+1, fmt, ap2); + va_end(ap2); + _talloc_set_name_const(ret, ret); return ret; } |