diff options
author | Yang Tse <yangsita@gmail.com> | 2010-02-05 18:07:19 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2010-02-05 18:07:19 +0000 |
commit | cad9c3f55fad5da988144dc83ad76a8544a071a2 (patch) | |
tree | 9231f49bc11dfdb69b4cac9af3b1dd473d1507ad /tests/libtest/lib503.c | |
parent | 12d01bc5f72c4c0f9aabfa45628d9c4702491fb0 (diff) | |
download | curl-cad9c3f55fad5da988144dc83ad76a8544a071a2.tar.gz |
Addes OOM handling for curl_easy_setopt() calls in test
Diffstat (limited to 'tests/libtest/lib503.c')
-rw-r--r-- | tests/libtest/lib503.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/tests/libtest/lib503.c b/tests/libtest/lib503.c index 11f1150c0..3e8f3dc55 100644 --- a/tests/libtest/lib503.c +++ b/tests/libtest/lib503.c @@ -29,7 +29,7 @@ int test(char *URL) { CURL *c; - CURLM *m; + CURLM *m = NULL; int res = 0; int running; char done = FALSE; @@ -49,12 +49,12 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - curl_easy_setopt(c, CURLOPT_PROXY, libtest_arg2); /* set in first.c */ - curl_easy_setopt(c, CURLOPT_URL, URL); - curl_easy_setopt(c, CURLOPT_USERPWD, "test:ing"); - curl_easy_setopt(c, CURLOPT_PROXYUSERPWD, "test:ing"); - curl_easy_setopt(c, CURLOPT_HTTPPROXYTUNNEL, 1L); - curl_easy_setopt(c, CURLOPT_HEADER, 1L); + test_setopt(c, CURLOPT_PROXY, libtest_arg2); /* set in first.c */ + test_setopt(c, CURLOPT_URL, URL); + test_setopt(c, CURLOPT_USERPWD, "test:ing"); + test_setopt(c, CURLOPT_PROXYUSERPWD, "test:ing"); + test_setopt(c, CURLOPT_HTTPPROXYTUNNEL, 1L); + test_setopt(c, CURLOPT_HEADER, 1L); if ((m = curl_multi_init()) == NULL) { fprintf(stderr, "curl_multi_init() failed\n"); @@ -139,9 +139,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; |