Skip to content

tool_operate: fix memory-leak on failed uploads#21062

Closed
bagder wants to merge 2 commits intomasterfrom
bagder/tool-cleanups
Closed

tool_operate: fix memory-leak on failed uploads#21062
bagder wants to merge 2 commits intomasterfrom
bagder/tool-cleanups

Conversation

@bagder
Copy link
Copy Markdown
Member

@bagder bagder commented Mar 22, 2026

Add test case 1673 to do repeated upload failures and verify there is no leak.

Reported-by: James Fuller

Add test case 1673 to do repeated upload failures and verify there
is no leak.

Reported-by: James Fuller
@github-actions github-actions bot added the tests label Mar 22, 2026
@bagder bagder marked this pull request as ready for review March 22, 2026 16:56
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

This PR aims to fix a memory leak in the curl tool when uploads fail (especially under retry scenarios), and adds a regression test intended to catch the leak.

Changes:

  • Centralize per_transfer resource cleanup in del_per_transfer() (including per->curl, per->url, per->outfile, per->uploadfile).
  • Remove now-redundant per-transfer cleanup from post_per_transfer().
  • Add test case 1673 and register it in the test data Makefile.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/tool_operate.c Moves easy-handle and per-transfer string frees into del_per_transfer() to avoid leaks when transfers are deleted without full post-cleanup.
tests/data/test1673 Adds a new test intended to exercise repeated upload failures with --retry.
tests/data/Makefile.am Registers test1673 in the testcases list.

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

@bagder bagder closed this in 9820e5d Mar 22, 2026
@bagder bagder deleted the bagder/tool-cleanups branch March 22, 2026 22:58
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.

2 participants