diff options
author | Simon Josefsson <simon@josefsson.org> | 2008-06-05 22:34:01 +0200 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2008-06-05 22:34:01 +0200 |
commit | 851ec92603fc33b2c218002661b9c8ff55efe6dd (patch) | |
tree | 158ffa5a88b2a01d984761f1753f61e9613a64e4 /tests/x509self.c | |
parent | 2c49b57fd43134fc7f6c7765ff46a47fadfe6f73 (diff) | |
download | gnutls-851ec92603fc33b2c218002661b9c8ff55efe6dd.tar.gz |
Revert last commit, fix memory leak the right way.
Diffstat (limited to 'tests/x509self.c')
-rw-r--r-- | tests/x509self.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/tests/x509self.c b/tests/x509self.c index d578ec5f9c..87938f890f 100644 --- a/tests/x509self.c +++ b/tests/x509self.c @@ -342,25 +342,6 @@ const gnutls_datum_t server_key = { server_key_pem, 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_certificate_allocate_credentials (&x509_cred); - gnutls_certificate_set_x509_trust_mem (x509_cred, &ca, GNUTLS_X509_FMT_PEM); - - gnutls_certificate_set_x509_key_mem (x509_cred, &server_cert, &server_key, - GNUTLS_X509_FMT_PEM); - - success ("Launched, generating DH parameters...\n"); - - generate_dh_params (); - - gnutls_certificate_set_dh_params (x509_cred, dh_params); - /* Socket operations */ listen_sd = socket (AF_INET, SOCK_STREAM, 0); @@ -400,6 +381,25 @@ 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_certificate_allocate_credentials (&x509_cred); + gnutls_certificate_set_x509_trust_mem (x509_cred, &ca, GNUTLS_X509_FMT_PEM); + + gnutls_certificate_set_x509_key_mem (x509_cred, &server_cert, &server_key, + GNUTLS_X509_FMT_PEM); + + success ("Launched, generating DH parameters...\n"); + + generate_dh_params (); + + gnutls_certificate_set_dh_params (x509_cred, dh_params); + client_len = sizeof (sa_cli); session = initialize_tls_session (); @@ -472,6 +472,11 @@ server (void) void doit (void) { + /* parent */ + server_start (); + if (error_count) + return; + child = fork (); if (child < 0) { @@ -483,10 +488,6 @@ doit (void) if (child) { int status; - /* parent */ - server_start (); - if (error_count) - return; server (); wait (&status); |