]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
http_aws_sigv4: fix scan-build "value stored to 'ret' is never read"
authorDaniel Stenberg <daniel@haxx.se>
Tue, 14 Mar 2023 23:14:31 +0000 (00:14 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 15 Mar 2023 06:32:01 +0000 (07:32 +0100)
Follow-up to 495d09810aa9a

Closes #10766

lib/http_aws_sigv4.c

index c64e3ec2ca5fd0ca6cdfc3ba419ee46a0f6fc51b..7d50cfff8fd4ec26064c56f74af11da5d079f57b 100644 (file)
@@ -318,7 +318,7 @@ static CURLcode calc_payload_hash(struct Curl_easy *data,
 {
   const char *post_data = data->set.postfields;
   size_t post_data_len = 0;
-  CURLcode ret = CURLE_OUT_OF_MEMORY;
+  CURLcode result;
 
   if(post_data) {
     if(data->set.postfieldsize < 0)
@@ -326,14 +326,11 @@ static CURLcode calc_payload_hash(struct Curl_easy *data,
     else
       post_data_len = (size_t)data->set.postfieldsize;
   }
-  ret = Curl_sha256it(sha_hash, (const unsigned char *) post_data,
-                      post_data_len);
-  if(ret)
-    goto fail;
-
-  sha256_to_hex(sha_hex, sha_hash);
-fail:
-  return ret;
+  result = Curl_sha256it(sha_hash, (const unsigned char *) post_data,
+                         post_data_len);
+  if(!result)
+    sha256_to_hex(sha_hex, sha_hash);
+  return result;
 }
 
 #define S3_UNSIGNED_PAYLOAD "UNSIGNED-PAYLOAD"
@@ -355,7 +352,6 @@ static CURLcode calc_s3_payload_hash(struct Curl_easy *data,
     ret = calc_payload_hash(data, sha_hash, sha_hex);
     if(ret)
       goto fail;
-    ret = CURLE_OUT_OF_MEMORY;
   }
   else {
     /* Fall back to s3's UNSIGNED-PAYLOAD */
@@ -501,7 +497,6 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy)
       ret = calc_payload_hash(data, sha_hash, sha_hex);
     if(ret)
       goto fail;
-    ret = CURLE_OUT_OF_MEMORY;
 
     payload_hash = sha_hex;
     /* may be shorter than SHA256_HEX_LENGTH, like S3_UNSIGNED_PAYLOAD */