aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest/lib533.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2010-02-05 18:07:19 +0000
committerYang Tse <yangsita@gmail.com>2010-02-05 18:07:19 +0000
commitcad9c3f55fad5da988144dc83ad76a8544a071a2 (patch)
tree9231f49bc11dfdb69b4cac9af3b1dd473d1507ad /tests/libtest/lib533.c
parent12d01bc5f72c4c0f9aabfa45628d9c4702491fb0 (diff)
Addes OOM handling for curl_easy_setopt() calls in test
Diffstat (limited to 'tests/libtest/lib533.c')
-rw-r--r--tests/libtest/lib533.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/libtest/lib533.c b/tests/libtest/lib533.c
index 92b371a81..810b075e5 100644
--- a/tests/libtest/lib533.c
+++ b/tests/libtest/lib533.c
@@ -28,7 +28,7 @@ int test(char *URL)
CURL *curl;
int running;
char done=FALSE;
- CURLM *m;
+ CURLM *m = NULL;
int current=0;
struct timeval ml_start;
struct timeval mp_start;
@@ -46,9 +46,9 @@ int test(char *URL)
return TEST_ERR_MAJOR_BAD;
}
- curl_easy_setopt(curl, CURLOPT_URL, URL);
- curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
- curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
+ test_setopt(curl, CURLOPT_URL, URL);
+ test_setopt(curl, CURLOPT_VERBOSE, 1);
+ test_setopt(curl, CURLOPT_FAILONERROR, 1);
if ((m = curl_multi_init()) == NULL) {
fprintf(stderr, "curl_multi_init() failed\n");
@@ -103,9 +103,9 @@ 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);
- curl_easy_setopt(curl, CURLOPT_URL, libtest_arg2);
- curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
- curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
+ test_setopt(curl, CURLOPT_URL, libtest_arg2);
+ test_setopt(curl, CURLOPT_VERBOSE, 1);
+ test_setopt(curl, CURLOPT_FAILONERROR, 1);
/* re-add it */
res = (int)curl_multi_add_handle(m, curl);
@@ -156,8 +156,11 @@ int test(char *URL)
res = TEST_ERR_RUNS_FOREVER;
}
+test_cleanup:
+
curl_easy_cleanup(curl);
- curl_multi_cleanup(m);
+ if(m)
+ curl_multi_cleanup(m);
curl_global_cleanup();
return res;