From 45d4bf5af38df12e194427a4e1ac8f3da75b33e3 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 6 Mar 2023 00:18:41 +0100 Subject: [PATCH] cookie: don't load cookies again when flushing Reported-by: Sergio Mijatovic Fixes #10677 Closes #10685 --- lib/cookie.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/cookie.c b/lib/cookie.c index fb8b4e97fb..0c6e0f7cda 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -336,10 +336,9 @@ void Curl_cookie_loadfiles(struct Curl_easy *data) if(list) { Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE); while(list) { - struct CookieInfo *newcookies = Curl_cookie_init(data, - list->data, - data->cookies, - data->set.cookiesession); + struct CookieInfo *newcookies = + Curl_cookie_init(data, list->data, data->cookies, + data->set.cookiesession); if(!newcookies) /* * Failure may be due to OOM or a bad cookie; both are ignored @@ -1800,11 +1799,6 @@ void Curl_flush_cookies(struct Curl_easy *data, bool cleanup) CURLcode res; if(data->set.str[STRING_COOKIEJAR]) { - /* If there is a list of cookie files to read, do it first so that - we have all the told files read before we write the new jar. - Curl_cookie_loadfiles() LOCKS and UNLOCKS the share itself! */ - Curl_cookie_loadfiles(data); - Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE); /* if we have a destination file for all the cookies to get dumped to */ -- 2.47.3