aboutsummaryrefslogtreecommitdiff
path: root/src/testcurl/https/tls_daemon_options_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testcurl/https/tls_daemon_options_test.c')
-rw-r--r--src/testcurl/https/tls_daemon_options_test.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/testcurl/https/tls_daemon_options_test.c b/src/testcurl/https/tls_daemon_options_test.c
index a0d8af97..f24ff4f9 100644
--- a/src/testcurl/https/tls_daemon_options_test.c
+++ b/src/testcurl/https/tls_daemon_options_test.c
@@ -160,39 +160,37 @@ test_https_transfer (FILE * test_fd, char *cipher_suite, int proto_version)
160 doc_path_len = PATH_MAX > 4096 ? 4096 : PATH_MAX; 160 doc_path_len = PATH_MAX > 4096 ? 4096 : PATH_MAX;
161 if (NULL == (doc_path = malloc (doc_path_len))) 161 if (NULL == (doc_path = malloc (doc_path_len)))
162 { 162 {
163 fclose (test_fd);
164 fprintf (stderr, MHD_E_MEM); 163 fprintf (stderr, MHD_E_MEM);
165 return -1; 164 return -1;
166 } 165 }
167 if (getcwd (doc_path, doc_path_len) == NULL) 166 if (getcwd (doc_path, doc_path_len) == NULL)
168 { 167 {
169 fclose (test_fd);
170 free (doc_path);
171 fprintf (stderr, "Error: failed to get working directory. %s\n", 168 fprintf (stderr, "Error: failed to get working directory. %s\n",
172 strerror (errno)); 169 strerror (errno));
170 free (doc_path);
173 return -1; 171 return -1;
174 } 172 }
175 173
176 if (NULL == (mem_test_file_local = malloc (len))) 174 if (NULL == (mem_test_file_local = malloc (len)))
177 { 175 {
178 fclose (test_fd);
179 fprintf (stderr, MHD_E_MEM); 176 fprintf (stderr, MHD_E_MEM);
177 free (doc_path);
180 return -1; 178 return -1;
181 } 179 }
182 180
183 fseek (test_fd, 0, SEEK_SET); 181 fseek (test_fd, 0, SEEK_SET);
184 if (fread (mem_test_file_local, sizeof (char), len, test_fd) != len) 182 if (fread (mem_test_file_local, sizeof (char), len, test_fd) != len)
185 { 183 {
186 fclose (test_fd);
187 fprintf (stderr, "Error: failed to read test file. %s\n", 184 fprintf (stderr, "Error: failed to read test file. %s\n",
188 strerror (errno)); 185 strerror (errno));
186 free (doc_path);
189 return -1; 187 return -1;
190 } 188 }
191 189
192 if (NULL == (cbc.buf = malloc (sizeof (char) * len))) 190 if (NULL == (cbc.buf = malloc (sizeof (char) * len)))
193 { 191 {
194 fclose (test_fd);
195 fprintf (stderr, MHD_E_MEM); 192 fprintf (stderr, MHD_E_MEM);
193 free (doc_path);
196 return -1; 194 return -1;
197 } 195 }
198 cbc.size = len; 196 cbc.size = len;
@@ -267,12 +265,14 @@ setupTestFile ()
267 { 265 {
268 fprintf (stderr, "Error: failed to write `%s. %s'\n", 266 fprintf (stderr, "Error: failed to write `%s. %s'\n",
269 test_file_name, strerror (errno)); 267 test_file_name, strerror (errno));
268 fclose (test_fd);
270 return NULL; 269 return NULL;
271 } 270 }
272 if (fflush (test_fd)) 271 if (fflush (test_fd))
273 { 272 {
274 fprintf (stderr, "Error: failed to flush test file stream. %s\n", 273 fprintf (stderr, "Error: failed to flush test file stream. %s\n",
275 strerror (errno)); 274 strerror (errno));
275 fclose (test_fd);
276 return NULL; 276 return NULL;
277 } 277 }
278 278
@@ -406,6 +406,7 @@ main (int argc, char *const *argv)
406 if (0 != curl_global_init (CURL_GLOBAL_ALL)) 406 if (0 != curl_global_init (CURL_GLOBAL_ALL))
407 { 407 {
408 fprintf (stderr, "Error: %s\n", strerror (errno)); 408 fprintf (stderr, "Error: %s\n", strerror (errno));
409 fclose (test_fd);
409 return -1; 410 return -1;
410 } 411 }
411 412