From: Zbigniew Jędrzejewski-Szmek Date: Fri, 9 Jul 2021 12:45:41 +0000 (+0200) Subject: creds: drop unnecessary initialization X-Git-Tag: v250-rc1~966^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bc1f27ff5515d8e35b881281d6f2f1a7ff1fed27;p=thirdparty%2Fsystemd.git creds: drop unnecessary initialization Coverity also thinks a leak happens here, CID #1458112. This seems wrong, but let's add an assert, maybe that'll help. --- diff --git a/src/basic/hexdecoct.c b/src/basic/hexdecoct.c index 172ae8a9218..8c83a0e71a6 100644 --- a/src/basic/hexdecoct.c +++ b/src/basic/hexdecoct.c @@ -645,6 +645,7 @@ ssize_t base64mem_full( *z = 0; *out = r; + assert(z >= r); /* Let static analyzers know that the answer is non-negative. */ return z - r; } diff --git a/src/creds/creds.c b/src/creds/creds.c index 50de685cd4a..19893fb3619 100644 --- a/src/creds/creds.c +++ b/src/creds/creds.c @@ -193,7 +193,7 @@ static int transcode( switch (arg_transcode) { case TRANSCODE_BASE64: { - char *buf = NULL; + char *buf; ssize_t l; l = base64mem_full(input, input_size, 79, &buf);