]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
gnutls.c:943:21: warning: comparison of integer expressions of different signedness...
authorTom Carroll <incentivedesign@gmail.com>
Mon, 17 May 2021 05:56:57 +0000 (22:56 -0700)
committerDavid Woodhouse <dwmw2@infradead.org>
Mon, 17 May 2021 10:30:24 +0000 (11:30 +0100)
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 <incentivedesign@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
gnutls.c

index 97aeaeb65fd088fad4562edabb26c31401f24f61..e2e21334a4dde449deb72a13e091338de1f729b8 100644 (file)
--- 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));
 }