From: Andreas Schneider Date: Mon, 12 Nov 2018 09:17:37 +0000 (+0100) Subject: lib:util Always initialize start and space X-Git-Tag: tdb-1.3.17~779 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=050d1e7d53c068efac109ec4ff7a686d152e6a45;p=thirdparty%2Fsamba.git lib:util Always initialize start and space Found by cppcheck. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13680 Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- diff --git a/lib/util/talloc_report.c b/lib/util/talloc_report.c index 63213a014b6..bed0fd91e43 100644 --- a/lib/util/talloc_report.c +++ b/lib/util/talloc_report.c @@ -33,8 +33,8 @@ static char *talloc_vasprintf_append_largebuf(char *buf, ssize_t *pstr_len, const char *fmt, va_list ap) { ssize_t str_len = *pstr_len; - size_t buflen, needed, space; - char *start, *tmpbuf; + size_t buflen, needed, space = 0; + char *start = NULL, *tmpbuf = NULL; va_list ap2; int printlen; @@ -52,9 +52,6 @@ static char *talloc_vasprintf_append_largebuf(char *buf, ssize_t *pstr_len, if (buflen > str_len) { start = buf + str_len; space = buflen - str_len; - } else { - start = NULL; - space = 0; } va_copy(ap2, ap);