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_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));
}