aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest/lib539.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/lib539.c
parent12d01bc5f72c4c0f9aabfa45628d9c4702491fb0 (diff)
Addes OOM handling for curl_easy_setopt() calls in test
Diffstat (limited to 'tests/libtest/lib539.c')
-rw-r--r--tests/libtest/lib539.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/tests/libtest/lib539.c b/tests/libtest/lib539.c
index eda78fcf4..f7df40854 100644
--- a/tests/libtest/lib539.c
+++ b/tests/libtest/lib539.c
@@ -16,8 +16,8 @@ int test(char *URL)
{
CURLcode res;
CURL *curl;
- char *newURL;
- struct curl_slist *slist;
+ char *newURL = NULL;
+ struct curl_slist *slist = NULL;
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
fprintf(stderr, "curl_global_init() failed\n");
@@ -33,9 +33,9 @@ int test(char *URL)
/*
* Begin with cURL set to use a single CWD to the URL's directory.
*/
- curl_easy_setopt(curl, CURLOPT_URL, URL);
- curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
- curl_easy_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD);
+ test_setopt(curl, CURLOPT_URL, URL);
+ test_setopt(curl, CURLOPT_VERBOSE, 1L);
+ test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD);
res = curl_easy_perform(curl);
@@ -63,14 +63,17 @@ int test(char *URL)
return TEST_ERR_MAJOR_BAD;
}
- curl_easy_setopt(curl, CURLOPT_URL, newURL);
- curl_easy_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD);
- curl_easy_setopt(curl, CURLOPT_QUOTE, slist);
+ test_setopt(curl, CURLOPT_URL, newURL);
+ test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD);
+ test_setopt(curl, CURLOPT_QUOTE, slist);
res = curl_easy_perform(curl);
+test_cleanup:
+
curl_slist_free_all(slist);
- free(newURL);
+ if(newURL)
+ free(newURL);
curl_easy_cleanup(curl);
curl_global_cleanup();