From aba8043075f6df09e489379f19f99cbc377b25d4 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 30 Mar 2024 23:42:48 +0100 Subject: [PATCH] tool: follow-up getenv fix 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 | 4 +--- src/tool_operate.c | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/tool_ipfs.c b/src/tool_ipfs.c index f2d26d2747..8e4f3b7eaa 100644 --- a/src/tool_ipfs.c +++ b/src/tool_ipfs.c @@ -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)) diff --git a/src/tool_operate.c b/src/tool_operate.c index 80106a6913..49ec7d835c 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -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");