From 5fe85587ccd2d3365540cd652e6a3bb1b0393f3a Mon Sep 17 00:00:00 2001 From: Pavel P Date: Mon, 18 Sep 2017 15:50:16 -0700 Subject: cookies: use lock when using CURLINFO_COOKIELIST Closes #1896 --- lib/cookie.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib/cookie.c') diff --git a/lib/cookie.c b/lib/cookie.c index 1231882ed..0374f94c1 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -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]) { -- cgit v1.2.3