diff options
author | Simon Josefsson <simon@josefsson.org> | 2008-06-05 22:35:23 +0200 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2008-06-05 22:35:23 +0200 |
commit | 8bbd327e9fd943af669722382c0bbbab8e17b12b (patch) | |
tree | 9d099c679ab48de8c02074861009a9d4a1deabe7 /tests/anonself.c | |
parent | 851ec92603fc33b2c218002661b9c8ff55efe6dd (diff) | |
download | gnutls-8bbd327e9fd943af669722382c0bbbab8e17b12b.tar.gz |
Fix memory leaks.
Diffstat (limited to 'tests/anonself.c')
-rw-r--r-- | tests/anonself.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/tests/anonself.c b/tests/anonself.c index 4b940ecd8f..b62ffb9445 100644 --- a/tests/anonself.c +++ b/tests/anonself.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation + * Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation * * Author: Simon Josefsson * @@ -237,21 +237,6 @@ int optval = 1; 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 (4711); - - gnutls_anon_allocate_server_credentials (&anoncred); - - success ("Launched, generating DH parameters...\n"); - - generate_dh_params (); - - gnutls_anon_set_server_dh_params (anoncred, dh_params); - /* Socket operations */ listen_sd = socket (AF_INET, SOCK_STREAM, 0); @@ -291,6 +276,21 @@ 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 (4711); + + gnutls_anon_allocate_server_credentials (&anoncred); + + success ("Launched, generating DH parameters...\n"); + + generate_dh_params (); + + gnutls_anon_set_server_dh_params (anoncred, dh_params); + client_len = sizeof (sa_cli); session = initialize_tls_session (); @@ -352,6 +352,8 @@ server (void) gnutls_anon_free_server_credentials (anoncred); + gnutls_dh_params_deinit (dh_params); + gnutls_global_deinit (); success ("server: finished\n"); |