Remove warning with GCC 12 and TSan

Compiler is unhappy that the return from mbedtls_cipher_get_name() could
be NULL as this is used in a printf statement.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
Paul Elliott 2023-11-24 17:12:24 +00:00
parent 356597f077
commit 80fa88e2fa

View file

@ -103,7 +103,14 @@ int main(int argc, char *argv[])
list = mbedtls_cipher_list();
while (*list) {
cipher_info = mbedtls_cipher_info_from_type(*list);
mbedtls_printf(" %s\n", mbedtls_cipher_info_get_name(cipher_info));
if (cipher_info) {
const char *name = mbedtls_cipher_info_get_name(cipher_info);
if (name) {
mbedtls_printf(" %s\n", mbedtls_cipher_info_get_name(cipher_info));
}
}
list++;
}