diff options
author | Simon Josefsson <simon@josefsson.org> | 2008-06-05 22:33:48 +0200 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2008-06-05 22:33:48 +0200 |
commit | 2c49b57fd43134fc7f6c7765ff46a47fadfe6f73 (patch) | |
tree | 24cd456d697378bd33a2e6b01e35a30bc2a06702 /tests/openpgpself.c | |
parent | e606cb0aa150b94655bff424f0f1e7273f901b19 (diff) | |
download | gnutls-2c49b57fd43134fc7f6c7765ff46a47fadfe6f73.tar.gz |
Fix memory leak.
Diffstat (limited to 'tests/openpgpself.c')
-rw-r--r-- | tests/openpgpself.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/tests/openpgpself.c b/tests/openpgpself.c index 6d502b6664..f5ef8b5722 100644 --- a/tests/openpgpself.c +++ b/tests/openpgpself.c @@ -379,29 +379,6 @@ const gnutls_datum_t server_key = { server_key_txt, sizeof (server_key_txt) }; void server_start (void) { - /* this must be called once in the program - */ - gnutls_global_init (); - - gnutls_global_set_log_function (tls_log_func); - gnutls_global_set_log_level (2); - - gnutls_certificate_allocate_credentials (&pgp_cred); - - ret = gnutls_certificate_set_openpgp_key_mem2 (pgp_cred, &server_crt, - &server_key, "auto", - GNUTLS_OPENPGP_FMT_BASE64); - if (err < 0) - { - fail ("Could not set server key files...\n"); - } - - success ("Launched, setting DH parameters...\n"); - - generate_dh_params (); - - gnutls_certificate_set_dh_params (pgp_cred, dh_params); - /* Socket operations */ listen_sd = socket (AF_INET, SOCK_STREAM, 0); @@ -441,6 +418,29 @@ server_start (void) void server (void) { + /* this must be called once in the program + */ + gnutls_global_init (); + + gnutls_global_set_log_function (tls_log_func); + gnutls_global_set_log_level (2); + + gnutls_certificate_allocate_credentials (&pgp_cred); + + ret = gnutls_certificate_set_openpgp_key_mem2 (pgp_cred, &server_crt, + &server_key, "auto", + GNUTLS_OPENPGP_FMT_BASE64); + if (err < 0) + { + fail ("Could not set server key files...\n"); + } + + success ("Launched, setting DH parameters...\n"); + + generate_dh_params (); + + gnutls_certificate_set_dh_params (pgp_cred, dh_params); + client_len = sizeof (sa_cli); session = initialize_tls_session (); @@ -502,6 +502,8 @@ server (void) gnutls_certificate_free_credentials (pgp_cred); + gnutls_dh_params_deinit (dh_params); + gnutls_global_deinit (); success ("server: finished\n"); |