From cb9bcba074e24e1e1cfa2b67341a055e1ed2cdb8 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 2 Feb 2009 07:13:22 +0000 Subject: [PATCH] fix --- src/testcurl/https/mhds_multi_daemon_test.c | 7 +++++++ src/testcurl/https/tls_authentication_test.c | 6 ++++-- src/testcurl/https/tls_daemon_options_test.c | 4 ++++ .../https/tls_multi_thread_mode_test.c | 18 ++++++++---------- src/testcurl/https/tls_thread_mode_test.c | 16 ++++++++-------- 5 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/testcurl/https/mhds_multi_daemon_test.c b/src/testcurl/https/mhds_multi_daemon_test.c index 69598d8f..6407daf7 100644 --- a/src/testcurl/https/mhds_multi_daemon_test.c +++ b/src/testcurl/https/mhds_multi_daemon_test.c @@ -160,6 +160,7 @@ test_daemon_get (FILE * test_fd, char *cipher_suite, int proto_version, { fprintf (stderr, "Error: failed to read test file. %s\n", strerror (errno)); + free (doc_path); return -1; } @@ -167,6 +168,8 @@ test_daemon_get (FILE * test_fd, char *cipher_suite, int proto_version, { fprintf (stderr, "Error: failed to read test file. %s\n", strerror (errno)); + free (mem_test_file_local); + free (doc_path); return -1; } cbc.size = len; @@ -206,6 +209,9 @@ test_daemon_get (FILE * test_fd, char *cipher_suite, int proto_version, fprintf (stderr, "curl_easy_perform failed: `%s'\n", curl_easy_strerror (errornum)); curl_easy_cleanup (c); + free (mem_test_file_local); + free (doc_path); + free (cbc.buf); return errornum; } @@ -261,6 +267,7 @@ test_concurent_daemon_pair (FILE * test_fd, char *cipher_suite, if (d2 == NULL) { + MHD_stop_daemon(d1); fprintf (stderr, MHD_E_SERVER_INIT); return -1; } diff --git a/src/testcurl/https/tls_authentication_test.c b/src/testcurl/https/tls_authentication_test.c index 7f576654..6e8cf0af 100644 --- a/src/testcurl/https/tls_authentication_test.c +++ b/src/testcurl/https/tls_authentication_test.c @@ -284,12 +284,14 @@ setupTestFile () { fprintf (stderr, "Error: failed to write `%s. %s'\n", test_file_name, strerror (errno)); + fclose (test_fd); return NULL; } if (fflush (test_fd)) { fprintf (stderr, "Error: failed to flush test file stream. %s\n", strerror (errno)); + fclose (test_fd); return NULL; } @@ -312,14 +314,14 @@ setup_ca_cert () { fprintf (stderr, "Error: failed to write `%s. %s'\n", ca_cert_file_name, strerror (errno)); - fclose (test_fd); + fclose (fd); return NULL; } if (fflush (fd)) { fprintf (stderr, "Error: failed to flush ca cert file stream. %s\n", strerror (errno)); - fclose (test_fd); + fclose (fd); return NULL; } diff --git a/src/testcurl/https/tls_daemon_options_test.c b/src/testcurl/https/tls_daemon_options_test.c index f24ff4f9..2575c340 100644 --- a/src/testcurl/https/tls_daemon_options_test.c +++ b/src/testcurl/https/tls_daemon_options_test.c @@ -230,6 +230,9 @@ test_https_transfer (FILE * test_fd, char *cipher_suite, int proto_version) fprintf (stderr, "curl_easy_perform failed: `%s'\n", curl_easy_strerror (errornum)); curl_easy_cleanup (c); + free (cbc.buf); + free (mem_test_file_local); + free (doc_path); return errornum; } @@ -240,6 +243,7 @@ test_https_transfer (FILE * test_fd, char *cipher_suite, int proto_version) fprintf (stderr, "Error: local file & received file differ.\n"); free (cbc.buf); free (mem_test_file_local); + free (doc_path); return -1; } diff --git a/src/testcurl/https/tls_multi_thread_mode_test.c b/src/testcurl/https/tls_multi_thread_mode_test.c index e0c0a304..eeb5e8a0 100644 --- a/src/testcurl/https/tls_multi_thread_mode_test.c +++ b/src/testcurl/https/tls_multi_thread_mode_test.c @@ -163,44 +163,39 @@ test_https_transfer (FILE * test_fd, char *cipher_suite, int proto_version) doc_path_len = PATH_MAX > 4096 ? 4096 : PATH_MAX; if (NULL == (doc_path = malloc (doc_path_len))) { - fclose (test_fd); fprintf (stderr, MHD_E_MEM); return -1; } if (getcwd (doc_path, doc_path_len) == NULL) { - fclose (test_fd); - free (doc_path); fprintf (stderr, "Error: failed to get working directory. %s\n", strerror (errno)); + free (doc_path); return -1; } if (NULL == (mem_test_file_local = malloc (len))) { - fclose (test_fd); - free (doc_path); fprintf (stderr, MHD_E_MEM); + free (doc_path); return -1; } fseek (test_fd, 0, SEEK_SET); if (fread (mem_test_file_local, sizeof (char), len, test_fd) != len) { - fclose (test_fd); - free (doc_path); - free (mem_test_file_local); fprintf (stderr, "Error: failed to read test file. %s\n", strerror (errno)); + free (doc_path); + free (mem_test_file_local); return -1; } if (NULL == (cbc.buf = malloc (len))) { - fclose (test_fd); + fprintf (stderr, MHD_E_MEM); free (doc_path); free (mem_test_file_local); - fprintf (stderr, MHD_E_MEM); return -1; } cbc.size = len; @@ -299,12 +294,14 @@ setupTestFile () { fprintf (stderr, "Error: failed to write `%s. %s'\n", test_file_name, strerror (errno)); + fclose (test_fd); return NULL; } if (fflush (test_fd)) { fprintf (stderr, "Error: failed to flush test file stream. %s\n", strerror (errno)); + fclose (test_fd); return NULL; } @@ -453,6 +450,7 @@ main (int argc, char *const *argv) if (0 != curl_global_init (CURL_GLOBAL_ALL)) { fprintf (stderr, "Error: %s\n", strerror (errno)); + fclose (test_fd); return -1; } diff --git a/src/testcurl/https/tls_thread_mode_test.c b/src/testcurl/https/tls_thread_mode_test.c index ed263e3f..24882d95 100644 --- a/src/testcurl/https/tls_thread_mode_test.c +++ b/src/testcurl/https/tls_thread_mode_test.c @@ -163,40 +163,37 @@ test_https_transfer (FILE * test_fd, char *cipher_suite, int proto_version) doc_path_len = PATH_MAX > 4096 ? 4096 : PATH_MAX; if (NULL == (doc_path = malloc (doc_path_len))) { - fclose (test_fd); fprintf (stderr, MHD_E_MEM); return -1; } if (getcwd (doc_path, doc_path_len) == NULL) { - fclose (test_fd); - free (doc_path); fprintf (stderr, "Error: failed to get working directory. %s\n", strerror (errno)); + free (doc_path); return -1; } if (NULL == (mem_test_file_local = malloc (len))) { - fclose (test_fd); - free (doc_path); fprintf (stderr, MHD_E_MEM); + free (doc_path); return -1; } fseek (test_fd, 0, SEEK_SET); if (fread (mem_test_file_local, sizeof (char), len, test_fd) != len) { - fclose (test_fd); - free (doc_path); fprintf (stderr, "Error: failed to read test file. %s\n", strerror (errno)); + fclose (test_fd); + free (doc_path); + free (mem_test_file_local); return -1; } if (NULL == (cbc.buf = malloc (len))) { - fclose (test_fd); free (doc_path); free (mem_test_file_local); fprintf (stderr, MHD_E_MEM); @@ -298,12 +295,14 @@ setupTestFile () { fprintf (stderr, "Error: failed to write `%s. %s'\n", test_file_name, strerror (errno)); + fclose (test_fd); return NULL; } if (fflush (test_fd)) { fprintf (stderr, "Error: failed to flush test file stream. %s\n", strerror (errno)); + fclose (test_fd); return NULL; } @@ -452,6 +451,7 @@ main (int argc, char *const *argv) if (0 != curl_global_init (CURL_GLOBAL_ALL)) { fprintf (stderr, "Error: %s\n", strerror (errno)); + fclose (test_fd); return -1; }