]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
setopt: acknowledge errors proper for CURLOPT_COOKIEJAR
authorDaniel Stenberg <daniel@haxx.se>
Mon, 13 May 2024 15:31:44 +0000 (17:31 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 14 May 2024 05:59:43 +0000 (07:59 +0200)
Error out on error, do not continue.

Closes #13624

lib/setopt.c

index 08100411cd57c0939305ae7c76df03db48cb50c9..e8b25454b2f9df4f426d64a4a3f6e715e9e3ecff 100644 (file)
@@ -779,22 +779,20 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
     /*
      * Set cookie file name to dump all cookies to when we're done.
      */
-  {
-    struct CookieInfo *newcookies;
     result = Curl_setstropt(&data->set.str[STRING_COOKIEJAR],
                             va_arg(param, char *));
-
-    /*
-     * Activate the cookie parser. This may or may not already
-     * have been made.
-     */
-    newcookies = Curl_cookie_init(data, NULL, data->cookies,
-                                  data->set.cookiesession);
-    if(!newcookies)
-      result = CURLE_OUT_OF_MEMORY;
-    data->cookies = newcookies;
-  }
-  break;
+    if(!result) {
+      /*
+       * Activate the cookie parser. This may or may not already
+       * have been made.
+       */
+      struct CookieInfo *newcookies =
+        Curl_cookie_init(data, NULL, data->cookies, data->set.cookiesession);
+      if(!newcookies)
+        result = CURLE_OUT_OF_MEMORY;
+      data->cookies = newcookies;
+    }
+    break;
 
   case CURLOPT_COOKIESESSION:
     /*