]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool: follow-up getenv fix
authorDaniel Stenberg <daniel@haxx.se>
Sat, 30 Mar 2024 22:42:48 +0000 (23:42 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 31 Mar 2024 09:04:00 +0000 (11:04 +0200)
Remove a double free. Change the IPFS env use to a plain getenv() simply
because coverity gets confused.

Follow-up to 9126b141c9398fe
Closes #13241

src/tool_ipfs.c
src/tool_operate.c

index f2d26d274748bcf2d5b07711701c78cc64b9af5f..8e4f3b7eaaaaa0984638f7cb36fd70389c9ef8a8 100644 (file)
@@ -78,12 +78,10 @@ static char *ipfs_gateway(void)
   ipfs_path = curl_getenv("IPFS_PATH");
 
   if(!ipfs_path) {
-    char *home = curl_getenv("HOME");
+    char *home = getenv("HOME");
     if(home && *home)
       ipfs_path = aprintf("%s/.ipfs/", home);
     /* fallback to "~/.ipfs", as that's the default location. */
-
-    curl_free(home);
   }
 
   if(!ipfs_path || ensure_trailing_slash(&ipfs_path))
index 80106a69133406bfab8a18b640b00238d560c1ef..49ec7d835cfedbdf3bedc56300f6fd851cb37643 100644 (file)
@@ -2605,7 +2605,6 @@ static CURLcode transfer_per_config(struct GlobalConfig *global,
             errorf(global, "out of memory");
             return CURLE_OUT_OF_MEMORY;
           }
-          curl_free(env);
           capath_from_env = true;
         }
         env = curl_getenv("SSL_CERT_FILE");