From: Tom Carroll Date: Mon, 17 May 2021 05:56:57 +0000 (-0700) Subject: gnutls.c:943:21: warning: comparison of integer expressions of different signedness... X-Git-Tag: v8.20~181 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=df6d08b56b66ca2837bddc7dd8bff52171f528df;p=users%2Fdwmw2%2Fopenconnect.git gnutls.c:943:21: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare] The gci->nr_certs field is an unsigned int. Use that as the loop variable for freeing them too. And we don't actually need the if (gci->certs) condition here either because ->nr_certs won't be non-zero in that case anyway. Signed-off-by: Tom Carroll Signed-off-by: David Woodhouse --- diff --git a/gnutls.c b/gnutls.c index 97aeaeb6..e2e21334 100644 --- a/gnutls.c +++ b/gnutls.c @@ -939,11 +939,9 @@ static void free_gtls_cert_info(struct gtls_cert_info *gci) { gnutls_x509_crl_deinit(gci->crl); gnutls_privkey_deinit(gci->pkey); - if (gci->certs) { - for (int i = 0; i < gci->nr_certs; i++) - gnutls_x509_crt_deinit(gci->certs[i]); - gnutls_free(gci->certs); - } + for (unsigned int i = 0; i < gci->nr_certs; i++) + gnutls_x509_crt_deinit(gci->certs[i]); + gnutls_free(gci->certs); memset(gci, 0, sizeof(*gci)); }