aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest/lib502.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/lib502.c
parent12d01bc5f72c4c0f9aabfa45628d9c4702491fb0 (diff)
Addes OOM handling for curl_easy_setopt() calls in test
Diffstat (limited to 'tests/libtest/lib502.c')
-rw-r--r--tests/libtest/lib502.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/libtest/lib502.c b/tests/libtest/lib502.c
index 85c300fbe..0a0a819b0 100644
--- a/tests/libtest/lib502.c
+++ b/tests/libtest/lib502.c
@@ -23,7 +23,7 @@
int test(char *URL)
{
CURL *c;
- CURLM *m;
+ CURLM *m = NULL;
int res = 0;
int running=1;
struct timeval mp_start;
@@ -40,7 +40,7 @@ int test(char *URL)
return TEST_ERR_MAJOR_BAD;
}
- curl_easy_setopt(c, CURLOPT_URL, URL);
+ test_setopt(c, CURLOPT_URL, URL);
if ((m = curl_multi_init()) == NULL) {
fprintf(stderr, "curl_multi_init() failed\n");
@@ -81,9 +81,13 @@ int test(char *URL)
res = TEST_ERR_RUNS_FOREVER;
}
- curl_multi_remove_handle(m, c);
+test_cleanup:
+
+ if(m) {
+ curl_multi_remove_handle(m, c);
+ curl_multi_cleanup(m);
+ }
curl_easy_cleanup(c);
- curl_multi_cleanup(m);
curl_global_cleanup();
return res;