]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_operate: fix a scan-build warning
authorDaniel Stenberg <daniel@haxx.se>
Wed, 9 Mar 2022 10:43:24 +0000 (11:43 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 10 Mar 2022 07:31:20 +0000 (08:31 +0100)
... and avoid the temp storing of the return code in a diff variable.

Closes #8565

src/tool_operate.c

index 05296c9e75517745b96f5b908f3453c8d290743b..37ff44795f03e471cb6b4473ee736d427be37353 100644 (file)
@@ -1736,20 +1736,17 @@ static CURLcode single_transfer(struct GlobalConfig *global,
         if(config->cookies) {
           struct curlx_dynbuf cookies;
           struct curl_slist *cl;
-          CURLcode ret;
 
           /* The maximum size needs to match MAX_NAME in cookie.h */
           curlx_dyn_init(&cookies, 4096);
           for(cl = config->cookies; cl; cl = cl->next) {
             if(cl == config->cookies)
-              ret = curlx_dyn_addf(&cookies, "%s", cl->data);
+              result = curlx_dyn_addf(&cookies, "%s", cl->data);
             else
-              ret = curlx_dyn_addf(&cookies, ";%s", cl->data);
+              result = curlx_dyn_addf(&cookies, ";%s", cl->data);
 
-            if(ret) {
-              result = CURLE_OUT_OF_MEMORY;
+            if(result)
               break;
-            }
           }
 
           my_setopt_str(curl, CURLOPT_COOKIE, curlx_dyn_ptr(&cookies));