]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_operate: free 'gateway' correctly
authorDaniel Stenberg <daniel@haxx.se>
Thu, 28 Sep 2023 07:32:39 +0000 (09:32 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 28 Sep 2023 08:14:38 +0000 (10:14 +0200)
Pointed out by Coverity. The fix in 93885cf3a8d4e was incomplete.

Also removed repeated wording in IPFS related error messages.

Closes #11969

src/tool_operate.c

index 19d55ba569c437ce5a228b93c991068639880d57..388b61f52e79a61db03bccfb3afc41fd62a37fb9 100644 (file)
@@ -857,34 +857,29 @@ static CURLcode ipfs_url_rewrite(CURLU *uh, const char *protocol, char **url,
   result = CURLE_OK;
 
 clean:
-  curl_free(gateway);
+  free(gateway);
   curl_free(cid);
   curl_free(pathbuffer);
-
-  if(ipfsurl) {
-    curl_url_cleanup(ipfsurl);
-  }
+  curl_url_cleanup(ipfsurl);
 
   switch(result) {
   case CURLE_URL_MALFORMAT:
     helpf(stderr, "malformed URL. Visit https://curl.se/"
           "docs/ipfs.html#Gateway-file-and-"
           "environment-variable for more "
-          "information for more information");
+          "information");
     break;
   case CURLE_FILE_COULDNT_READ_FILE:
     helpf(stderr, "IPFS automatic gateway detection "
           "failure. Visit https://curl.se/docs/"
           "ipfs.html#Malformed-gateway-URL for "
-          "more information for more "
-          "information");
+          "more information");
     break;
   case CURLE_BAD_FUNCTION_ARGUMENT:
     helpf(stderr, "--ipfs-gateway argument results in "
           "malformed URL. Visit https://curl.se/"
           "docs/ipfs.html#Malformed-gateway-URL "
-          "for more information for more "
-          "information");
+          "for more information");
     break;
   default:
     break;