Skip to content

tool_operate: fix minor memory-leak on early error#20954

Closed
bagder wants to merge 1 commit intomasterfrom
bagder/curlrc-path-free
Closed

tool_operate: fix minor memory-leak on early error#20954
bagder wants to merge 1 commit intomasterfrom
bagder/curlrc-path-free

Conversation

@bagder
Copy link
Copy Markdown
Member

@bagder bagder commented Mar 17, 2026

When .curlrc is parsed successfully but the tool exits early before parse_args() executes; the allocated path was not freed.

Spotted by Codex Security

When .curlrc is parsed successfully but the tool exits early before
parse_args() executes; the allocated path was not freed.

Spotted by Codex Security
@bagder bagder marked this pull request as ready for review March 17, 2026 12:43
@bagder bagder requested a review from Copilot March 17, 2026 12:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a small memory leak in the curl tool’s operate() flow when .curlrc is successfully resolved but execution exits before parse_args() runs (e.g., early help/usage path).

Changes:

  • Stop freeing curlrc_path only in the found_curlrc / post-parse_args() block.
  • Free curlrc_path unconditionally during the function’s common cleanup path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@testclutch
Copy link
Copy Markdown

Analysis of PR #20954 at 8981ae58:

Test ../../tests/http/test_05_errors.py::TestErrors::test_05_01_partial_1[h3] failed, but it has been 1.8% flaky lately, so it's probably NOT a fault of the PR. Note that this test has failed in 2 different CI jobs (the link just goes to one of them).

Test 1501 failed, which has NOT been flaky recently, so there could be a real issue in this PR. Note that this test has failed in 12 different CI jobs (the link just goes to one of them). Note that this CI job has had a number of other flaky tests recently (2, to be exact) so it may be that this failure is rather a systemic issue with this job and not with this specific PR.

Generated by Testclutch

@bagder bagder closed this in 90b9f51 Mar 17, 2026
@bagder bagder deleted the bagder/curlrc-path-free branch March 17, 2026 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants