summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2015-03-25 15:52:15 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2015-03-25 15:56:06 +0100
commite6573d30d78fbca4026ce9869abdbe01933f41f4 (patch)
tree8f05359afd64bd3f9a71d3aafe0d3761533d6550 /src
parent300d55df7aa5e5fd611f566ea66b8cfc2724a89a (diff)
downloadgnutls-e6573d30d78fbca4026ce9869abdbe01933f41f4.tar.gz
certtool: eliminated memory leaks on verification
Diffstat (limited to 'src')
-rw-r--r--src/certtool.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/certtool.c b/src/certtool.c
index e90498b314..a267ac815f 100644
--- a/src/certtool.c
+++ b/src/certtool.c
@@ -2291,6 +2291,7 @@ _verify_x509_mem(const void *cert, int cert_size, const void *ca,
const char *hostname, const char *email)
{
int ret;
+ unsigned i;
gnutls_datum_t tmp;
gnutls_x509_crt_t *x509_cert_list = NULL;
gnutls_x509_crt_t *x509_ca_list = NULL;
@@ -2455,8 +2456,10 @@ _verify_x509_mem(const void *cert, int cert_size, const void *ca,
fprintf(outfile, "\n\n");
+ gnutls_x509_trust_list_deinit(list, 0);
+ for (i=0;i<x509_ncerts;i++)
+ gnutls_x509_crt_deinit(x509_cert_list[i]);
gnutls_free(x509_cert_list);
- gnutls_x509_trust_list_deinit(list, 1);
if (output != 0)
exit(EXIT_FAILURE);
@@ -2502,7 +2505,7 @@ static void verify_chain(void)
buf[size] = 0;
_verify_x509_mem(buf, size, NULL, 0, 0, OPT_ARG(PURPOSE), OPT_ARG(HOSTNAME), OPT_ARG(EMAIL));
-
+ free(buf);
}
static void verify_certificate(common_info_st * cinfo)