From df6d08b56b66ca2837bddc7dd8bff52171f528df Mon Sep 17 00:00:00 2001 From: Tom Carroll Date: Sun, 16 May 2021 22:56:57 -0700 Subject: [PATCH] =?utf8?q?gnutls.c:943:21:=20warning:=20comparison=20of=20?= =?utf8?q?integer=20expressions=20of=20different=20signedness:=20=E2=80=98?= =?utf8?q?int=E2=80=99=20and=20=E2=80=98unsigned=20int=E2=80=99=20[-Wsign-?= =?utf8?q?compare]?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- gnutls.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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)); } -- 2.49.0