From bc1f27ff5515d8e35b881281d6f2f1a7ff1fed27 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 9 Jul 2021 14:45:41 +0200 Subject: [PATCH] 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. --- src/basic/hexdecoct.c | 1 + src/creds/creds.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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); -- 2.47.3