commit cb9bcba074e24e1e1cfa2b67341a055e1ed2cdb8
parent cdc246a32e3efdf3293e97f833a89d2d517df3ea
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 2 Feb 2009 07:13:22 +0000
fix
Diffstat:
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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;
}