]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cookie: don't load cookies again when flushing
authorDaniel Stenberg <daniel@haxx.se>
Sun, 5 Mar 2023 23:18:41 +0000 (00:18 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 6 Mar 2023 14:51:56 +0000 (15:51 +0100)
Reported-by: Sergio Mijatovic
Fixes #10677
Closes #10685

lib/cookie.c

index fb8b4e97fb7a83523ff2b03154278113e04c7254..0c6e0f7cda8bca450f37fca94f9c4cc62e026593 100644 (file)
@@ -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 */