cookies: use lock when using CURLINFO_COOKIELIST

Closes #1896
This commit is contained in:
Pavel P 2017-09-18 15:50:16 -07:00 committed by Daniel Stenberg
parent c73ebb8537
commit 5fe85587cc
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 19 additions and 8 deletions

View file

@ -1402,7 +1402,7 @@ static int cookie_output(struct CookieInfo *c, const char *dumphere)
return 0;
}
struct curl_slist *Curl_cookie_list(struct Curl_easy *data)
static struct curl_slist *cookie_list(struct Curl_easy *data)
{
struct curl_slist *list = NULL;
struct curl_slist *beg;
@ -1433,6 +1433,15 @@ struct curl_slist *Curl_cookie_list(struct Curl_easy *data)
return list;
}
struct curl_slist *Curl_cookie_list(struct Curl_easy *data)
{
struct curl_slist *list;
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
list = cookie_list(data);
Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
return list;
}
void Curl_flush_cookies(struct Curl_easy *data, int cleanup)
{
if(data->set.str[STRING_COOKIEJAR]) {