summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2007-05-02 09:48:29 +0000
committerSimon Josefsson <simon@josefsson.org>2007-05-02 09:48:29 +0000
commit0d59eed9524830e6715df7a39fc005ba55c3c726 (patch)
tree1e258951b276d0a9552696145351b7365ac9632d /tests
parentd5ee44c633305d83164f41d67d4a4c2d82b07e3a (diff)
downloadgnutls-0d59eed9524830e6715df7a39fc005ba55c3c726.tar.gz
Fix mem leak.
Diffstat (limited to 'tests')
-rw-r--r--tests/pkcs11/pkcs11-ca.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/pkcs11/pkcs11-ca.c b/tests/pkcs11/pkcs11-ca.c
index 7de6a6d2cf..5fc581f74b 100644
--- a/tests/pkcs11/pkcs11-ca.c
+++ b/tests/pkcs11/pkcs11-ca.c
@@ -35,7 +35,7 @@ doit (void)
{
int ret;
gnutls_x509_crt_t *ca_list;
- unsigned int ncas;
+ unsigned int ncas, i;
ret = gnutls_global_init ();
if (ret < 0)
@@ -44,6 +44,16 @@ doit (void)
ret = gnutls_pkcs11_get_ca_certificates (&ca_list, &ncas);
if (ret < 0)
fail ("Error getting CAs from PKCS#11: %d\n", ret);
+ else
+ {
+ for (i = 0; i < ncas; i++)
+ {
+ success ("Certificate %d\n", i);
+ gnutls_x509_crt_deinit (ca_list[i]);
+ }
+
+ gnutls_free (ca_list);
+ }
gnutls_global_deinit ();
}