mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
fix
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user