lib:util Always initialize start and space
authorAndreas Schneider <asn@samba.org>
Mon, 12 Nov 2018 09:17:37 +0000 (10:17 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 14 Nov 2018 04:07:15 +0000 (05:07 +0100)
Found by cppcheck.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13680

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/util/talloc_report.c

index 63213a014b6a3f017d41ebbedcc1bac1e9d0e765..bed0fd91e43edd4d3f9902a24d3824f10f7be2bb 100644 (file)
@@ -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);