diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-04-28 18:08:56 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-04-28 18:09:00 +0200 |
commit | c989c07bb86a2fc5e96689d77009c90ab1a5927f (patch) | |
tree | f8692afed09e3133e8cfc1d55641f6e4897d23d0 /src | |
parent | 4cd6694c6d58843e0f6246ca85da3d32bd97ca14 (diff) | |
download | gnutls-c989c07bb86a2fc5e96689d77009c90ab1a5927f.tar.gz |
certtool: eliminated memory leaks in DH parameter printing/generation.
Diffstat (limited to 'src')
-rw-r--r-- | src/certtool-common.c | 7 | ||||
-rw-r--r-- | src/certtool-common.h | 2 | ||||
-rw-r--r-- | src/certtool.c | 2 |
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 |