diff options
-rw-r--r-- | source4/lib/talloc/talloc.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source4/lib/talloc/talloc.c b/source4/lib/talloc/talloc.c index 72765448c7..31796a247b 100644 --- a/source4/lib/talloc/talloc.c +++ b/source4/lib/talloc/talloc.c @@ -36,6 +36,8 @@ #include <stdarg.h> #include <stdint.h> #include "talloc.h" +/* assume a modern system */ +#define HAVE_VA_COPY #endif /* use this to force every realloc to change the pointer, to stress test @@ -946,10 +948,16 @@ static char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap) PRINT static char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap) { - struct talloc_chunk *tc = talloc_chunk_from_ptr(s); + struct talloc_chunk *tc; int len, s_len; va_list ap2; + if (s == NULL) { + return talloc_vasprintf(NULL, fmt, ap); + } + + tc = talloc_chunk_from_ptr(s); + VA_COPY(ap2, ap); s_len = tc->size - 1; |