summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2016-04-28 18:08:56 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2016-04-28 18:09:00 +0200
commitc989c07bb86a2fc5e96689d77009c90ab1a5927f (patch)
treef8692afed09e3133e8cfc1d55641f6e4897d23d0 /src
parent4cd6694c6d58843e0f6246ca85da3d32bd97ca14 (diff)
downloadgnutls-c989c07bb86a2fc5e96689d77009c90ab1a5927f.tar.gz
certtool: eliminated memory leaks in DH parameter printing/generation.
Diffstat (limited to 'src')
-rw-r--r--src/certtool-common.c7
-rw-r--r--src/certtool-common.h2
-rw-r--r--src/certtool.c2
3 files changed, 10 insertions, 1 deletions
diff --git a/src/certtool-common.c b/src/certtool-common.c
index 7e18a7f09d..60f1930ec3 100644
--- a/src/certtool-common.c
+++ b/src/certtool-common.c
@@ -1044,6 +1044,8 @@ void dh_info(FILE * infile, FILE * outfile, common_info_st * ci)
}
}
+ gnutls_free(p.data);
+ gnutls_free(g.data);
gnutls_dh_params_deinit(dh_params);
}
@@ -1420,6 +1422,11 @@ int generate_prime(FILE * outfile, int how, common_info_st * info)
}
+ if (how != 0) {
+ gnutls_free(p.data);
+ gnutls_free(g.data);
+ }
+
gnutls_dh_params_deinit(dh_params);
return 0;
diff --git a/src/certtool-common.h b/src/certtool-common.h
index 0bc9c259fc..b773b27ce6 100644
--- a/src/certtool-common.h
+++ b/src/certtool-common.h
@@ -57,7 +57,7 @@ typedef struct common_info {
/* for key generation */
unsigned provable;
- const unsigned char *seed;
+ unsigned char *seed;
unsigned seed_size;
const char *pin;
diff --git a/src/certtool.c b/src/certtool.c
index d59d0e5e6d..8682de43c9 100644
--- a/src/certtool.c
+++ b/src/certtool.c
@@ -1311,6 +1311,8 @@ static void cmd_parser(int argc, char **argv)
if (outfile != stdout)
fclose(outfile);
+
+ free(cinfo.seed);
#ifdef ENABLE_PKCS11
gnutls_pkcs11_deinit();
#endif