aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-07-28 21:50:34 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-07-28 21:50:34 +0000
commitec3f269d1fa82a1101a638f1df6fd14c9fc831e5 (patch)
treec0c99d61af232674aff4dcd12fc41950a3f6224f /lib
parent1c388a52a5bb87844700b9eaf3ddf0a1f2647afe (diff)
now strdups the cookielist inpointer before passed on, as the cookie function
modifies it
Diffstat (limited to 'lib')
-rw-r--r--lib/url.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/url.c b/lib/url.c
index 7c34ee19a..2cef9e471 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -780,32 +780,37 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
case CURLOPT_COOKIELIST:
argptr = va_arg(param, char *);
- if (argptr == NULL)
+ if(argptr == NULL)
break;
- if (strequal(argptr, "ALL")) {
- if (data->cookies == NULL) {
- break;
- }
- else {
+ if(strequal(argptr, "ALL")) {
+ if(data->cookies) {
/* clear all cookies */
Curl_cookie_freelist(data->cookies->cookies);
data->cookies->cookies = NULL;
- break;
}
+ break;
}
- if (!data->cookies)
+ if(!data->cookies)
/* if cookie engine was not running, activate it */
data->cookies = Curl_cookie_init(data, NULL, NULL, TRUE);
- if (checkprefix("Set-Cookie:", argptr))
+ argptr = strdup(argptr);
+ if(!argptr) {
+ result = CURLE_OUT_OF_MEMORY;
+ break;
+ }
+
+ if(checkprefix("Set-Cookie:", argptr))
/* HTTP Header format line */
Curl_cookie_add(data, data->cookies, TRUE, argptr + 11, NULL, NULL);
else
/* Netscape format line */
Curl_cookie_add(data, data->cookies, FALSE, argptr, NULL, NULL);
+
+ free(argptr);
break;
#endif /* CURL_DISABLE_COOKIES */