mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
cookie: avoid mutex deadlock
... by removing the extra mutex locks around th call to Curl_flush_cookies() which takes care of the locking itself already. Bug: http://curl.haxx.se/mail/lib-2014-02/0184.html
This commit is contained in:
parent
f069b40f9d
commit
aa68848451
11
lib/url.c
11
lib/url.c
@ -1169,18 +1169,20 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
if(argptr == NULL)
|
||||
break;
|
||||
|
||||
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
|
||||
|
||||
if(Curl_raw_equal(argptr, "ALL")) {
|
||||
/* clear all cookies */
|
||||
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
|
||||
Curl_cookie_clearall(data->cookies);
|
||||
Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
|
||||
}
|
||||
else if(Curl_raw_equal(argptr, "SESS")) {
|
||||
/* clear session cookies */
|
||||
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
|
||||
Curl_cookie_clearsess(data->cookies);
|
||||
Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
|
||||
}
|
||||
else if(Curl_raw_equal(argptr, "FLUSH")) {
|
||||
/* flush cookies to file */
|
||||
/* flush cookies to file, takes care of the locking */
|
||||
Curl_flush_cookies(data, 0);
|
||||
}
|
||||
else {
|
||||
@ -1193,6 +1195,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
else {
|
||||
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
|
||||
|
||||
if(checkprefix("Set-Cookie:", argptr))
|
||||
/* HTTP Header format line */
|
||||
@ -1202,10 +1205,10 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
/* Netscape format line */
|
||||
Curl_cookie_add(data, data->cookies, FALSE, argptr, NULL, NULL);
|
||||
|
||||
Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
|
||||
free(argptr);
|
||||
}
|
||||
}
|
||||
Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
|
||||
|
||||
break;
|
||||
#endif /* CURL_DISABLE_COOKIES */
|
||||
|
Loading…
Reference in New Issue
Block a user