aboutsummaryrefslogtreecommitdiff
path: root/src/testcurl/https/tls_thread_mode_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testcurl/https/tls_thread_mode_test.c')
-rw-r--r--src/testcurl/https/tls_thread_mode_test.c16
1 files changed, 8 insertions, 8 deletions
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)
163 doc_path_len = PATH_MAX > 4096 ? 4096 : PATH_MAX; 163 doc_path_len = PATH_MAX > 4096 ? 4096 : PATH_MAX;
164 if (NULL == (doc_path = malloc (doc_path_len))) 164 if (NULL == (doc_path = malloc (doc_path_len)))
165 { 165 {
166 fclose (test_fd);
167 fprintf (stderr, MHD_E_MEM); 166 fprintf (stderr, MHD_E_MEM);
168 return -1; 167 return -1;
169 } 168 }
170 if (getcwd (doc_path, doc_path_len) == NULL) 169 if (getcwd (doc_path, doc_path_len) == NULL)
171 { 170 {
172 fclose (test_fd);
173 free (doc_path);
174 fprintf (stderr, "Error: failed to get working directory. %s\n", 171 fprintf (stderr, "Error: failed to get working directory. %s\n",
175 strerror (errno)); 172 strerror (errno));
173 free (doc_path);
176 return -1; 174 return -1;
177 } 175 }
178 176
179 if (NULL == (mem_test_file_local = malloc (len))) 177 if (NULL == (mem_test_file_local = malloc (len)))
180 { 178 {
181 fclose (test_fd);
182 free (doc_path);
183 fprintf (stderr, MHD_E_MEM); 179 fprintf (stderr, MHD_E_MEM);
180 free (doc_path);
184 return -1; 181 return -1;
185 } 182 }
186 183
187 fseek (test_fd, 0, SEEK_SET); 184 fseek (test_fd, 0, SEEK_SET);
188 if (fread (mem_test_file_local, sizeof (char), len, test_fd) != len) 185 if (fread (mem_test_file_local, sizeof (char), len, test_fd) != len)
189 { 186 {
190 fclose (test_fd);
191 free (doc_path);
192 fprintf (stderr, "Error: failed to read test file. %s\n", 187 fprintf (stderr, "Error: failed to read test file. %s\n",
193 strerror (errno)); 188 strerror (errno));
189 fclose (test_fd);
190 free (doc_path);
191 free (mem_test_file_local);
194 return -1; 192 return -1;
195 } 193 }
196 194
197 if (NULL == (cbc.buf = malloc (len))) 195 if (NULL == (cbc.buf = malloc (len)))
198 { 196 {
199 fclose (test_fd);
200 free (doc_path); 197 free (doc_path);
201 free (mem_test_file_local); 198 free (mem_test_file_local);
202 fprintf (stderr, MHD_E_MEM); 199 fprintf (stderr, MHD_E_MEM);
@@ -298,12 +295,14 @@ setupTestFile ()
298 { 295 {
299 fprintf (stderr, "Error: failed to write `%s. %s'\n", 296 fprintf (stderr, "Error: failed to write `%s. %s'\n",
300 test_file_name, strerror (errno)); 297 test_file_name, strerror (errno));
298 fclose (test_fd);
301 return NULL; 299 return NULL;
302 } 300 }
303 if (fflush (test_fd)) 301 if (fflush (test_fd))
304 { 302 {
305 fprintf (stderr, "Error: failed to flush test file stream. %s\n", 303 fprintf (stderr, "Error: failed to flush test file stream. %s\n",
306 strerror (errno)); 304 strerror (errno));
305 fclose (test_fd);
307 return NULL; 306 return NULL;
308 } 307 }
309 308
@@ -452,6 +451,7 @@ main (int argc, char *const *argv)
452 if (0 != curl_global_init (CURL_GLOBAL_ALL)) 451 if (0 != curl_global_init (CURL_GLOBAL_ALL))
453 { 452 {
454 fprintf (stderr, "Error: %s\n", strerror (errno)); 453 fprintf (stderr, "Error: %s\n", strerror (errno));
454 fclose (test_fd);
455 return -1; 455 return -1;
456 } 456 }
457 457