From 90b9f514581d671afcf66a59d4041e76f0a82cce Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 17 Mar 2026 13:19:25 +0100 Subject: [PATCH] tool_operate: fix minor memory-leak on early error When .curlrc is parsed successfully but the tool exits early before parse_args() executes; the allocated path was not freed. Spotted by Codex Security Closes #20954 --- src/tool_operate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tool_operate.c b/src/tool_operate.c index 6c47c13631..fdb7e1052f 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -2296,7 +2296,6 @@ CURLcode operate(int argc, argv_item_t argv[]) if(found_curlrc) { /* After parse_args so notef knows the verbosity */ notef("Read config file from '%s'", curlrc_path); - curlx_free(curlrc_path); } if(err) { result = CURLE_OK; @@ -2394,7 +2393,7 @@ CURLcode operate(int argc, argv_item_t argv[]) errorf("out of memory"); } } - + curlx_free(curlrc_path); varcleanup(); return result;