From 8bbd327e9fd943af669722382c0bbbab8e17b12b Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Thu, 5 Jun 2008 22:35:23 +0200 Subject: [PATCH] Fix memory leaks. --- tests/anonself.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/tests/anonself.c b/tests/anonself.c index 4b940ecd8..b62ffb944 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"); -- 2.11.4.GIT