aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest/lib526.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libtest/lib526.c')
-rw-r--r--tests/libtest/lib526.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/tests/libtest/lib526.c b/tests/libtest/lib526.c
index b4d891337..600ed65e5 100644
--- a/tests/libtest/lib526.c
+++ b/tests/libtest/lib526.c
@@ -47,7 +47,7 @@ int test(char *URL)
CURL *curl[NUM_HANDLES];
int running;
char done=FALSE;
- CURLM *m;
+ CURLM *m = NULL;
int current=0;
int i, j;
struct timeval ml_start;
@@ -72,10 +72,28 @@ int test(char *URL)
curl_global_cleanup();
return TEST_ERR_MAJOR_BAD + i;
}
- curl_easy_setopt(curl[i], CURLOPT_URL, URL);
+ res = curl_easy_setopt(curl[i], CURLOPT_URL, URL);
+ if(res) {
+ fprintf(stderr, "curl_easy_setopt() failed "
+ "on handle #%d\n", i);
+ for (j=i; j >= 0; j--) {
+ curl_easy_cleanup(curl[j]);
+ }
+ curl_global_cleanup();
+ return TEST_ERR_MAJOR_BAD + i;
+ }
/* go verbose */
- curl_easy_setopt(curl[i], CURLOPT_VERBOSE, 1L);
+ res = curl_easy_setopt(curl[i], CURLOPT_VERBOSE, 1L);
+ if(res) {
+ fprintf(stderr, "curl_easy_setopt() failed "
+ "on handle #%d\n", i);
+ for (j=i; j >= 0; j--) {
+ curl_easy_cleanup(curl[j]);
+ }
+ curl_global_cleanup();
+ return TEST_ERR_MAJOR_BAD + i;
+ }
}
if ((m = curl_multi_init()) == NULL) {
@@ -142,8 +160,8 @@ int test(char *URL)
/* make us re-use the same handle all the time, and try resetting
the handle first too */
curl_easy_reset(curl[0]);
- curl_easy_setopt(curl[0], CURLOPT_URL, URL);
- curl_easy_setopt(curl[0], CURLOPT_VERBOSE, 1L);
+ test_setopt(curl[0], CURLOPT_URL, URL);
+ test_setopt(curl[0], CURLOPT_VERBOSE, 1L);
/* re-add it */
res = (int)curl_multi_add_handle(m, curl[0]);
@@ -197,16 +215,20 @@ int test(char *URL)
res = TEST_ERR_RUNS_FOREVER;
}
+test_cleanup:
+
#ifndef LIB527
/* get NUM_HANDLES easy handles */
for(i=0; i < NUM_HANDLES; i++) {
#ifdef LIB526
- curl_multi_remove_handle(m, curl[i]);
+ if(m)
+ curl_multi_remove_handle(m, curl[i]);
#endif
curl_easy_cleanup(curl[i]);
}
#endif
- curl_multi_cleanup(m);
+ if(m)
+ curl_multi_cleanup(m);
curl_global_cleanup();
return res;