aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest/lib539.c
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2008-09-22 17:20:29 +0000
committerDan Fandrich <dan@coneharvesters.com>2008-09-22 17:20:29 +0000
commitabe61b99261902d58ec72742ea932c580b458d26 (patch)
tree3d88c03d6699d9107945a0e606a872333d78537e /tests/libtest/lib539.c
parent54e49d10d2d47fae72472e27d97891b1de5451ae (diff)
Fixed test 539 to handle an out of memory condition that shows up now
that memdebug.h is included in the test programs.
Diffstat (limited to 'tests/libtest/lib539.c')
-rw-r--r--tests/libtest/lib539.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/tests/libtest/lib539.c b/tests/libtest/lib539.c
index c99344421..eda78fcf4 100644
--- a/tests/libtest/lib539.c
+++ b/tests/libtest/lib539.c
@@ -35,7 +35,7 @@ int test(char *URL)
*/
curl_easy_setopt(curl, CURLOPT_URL, URL);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
- curl_easy_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
+ curl_easy_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD);
res = curl_easy_perform(curl);
@@ -47,13 +47,24 @@ int test(char *URL)
* even though no directories are stored in the ftpconn->dirs array (after a
* call to freedirs).
*/
- newURL = strcat (strcpy ((char*)malloc (strlen (URL) + 3),
- URL),
- "./");
+ newURL = malloc(strlen(URL) + 3);
+ if (newURL == NULL) {
+ curl_easy_cleanup(curl);
+ curl_global_cleanup();
+ return TEST_ERR_MAJOR_BAD;
+ }
+ newURL = strcat(strcpy(newURL, URL), "./");
+
slist = curl_slist_append (NULL, "SYST");
+ if (slist == NULL) {
+ free(newURL);
+ curl_easy_cleanup(curl);
+ curl_global_cleanup();
+ return TEST_ERR_MAJOR_BAD;
+ }
curl_easy_setopt(curl, CURLOPT_URL, newURL);
- curl_easy_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
+ curl_easy_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD);
curl_easy_setopt(curl, CURLOPT_QUOTE, slist);
res = curl_easy_perform(curl);