libkmipclient: Fix -Wmaybe-uninitialized warning with gcc 12

Gcc 12 produces a -Wmaybe-uninitialized warning that the content
of the tmp buffer may be uninitialized. This is a false positive.
Silence the warning by using calloc instead of malloc to ensure
that the allocated buffer is initialized.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Ingo Franzki
2022-05-24 08:49:23 +02:00
committed by Jan Höppner
parent f51dc05f7f
commit 57f3527799

View File

@@ -259,7 +259,7 @@ int kmip_decode_bignum(const unsigned char *data, uint32_t length, BIGNUM **bn)
if (data[0] & 0x80) {
neg = 1;
tmp = malloc(length);
tmp = calloc(1, length);
if (tmp == NULL)
return -ENOMEM;