Skip to content

tool_getparam: use correct free function for libcurl memory#21075

Closed
bagder wants to merge 1 commit intomasterfrom
bagder/urlencode-memory
Closed

tool_getparam: use correct free function for libcurl memory#21075
bagder wants to merge 1 commit intomasterfrom
bagder/urlencode-memory

Conversation

@bagder
Copy link
Copy Markdown
Member

@bagder bagder commented Mar 23, 2026

Memory returned from curl_easy_escape() should be fred with curl_free() to avoid surprises.

Follow-up to f37840a

Spotted by Codex Security

Memory returned from curl_easy_escape() should be fred with curl_free()
to avoid surprises.

Follow-up to f37840a

Spotted by Codex Security
@bagder bagder marked this pull request as ready for review March 23, 2026 14:17
@bagder bagder requested a review from Copilot March 23, 2026 14:18
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 fixes an allocator mismatch in the curl tool by ensuring that the string returned from curl_easy_escape() is not later freed with the tool’s curlx_free/tool_safefree, which could be problematic when libcurl is configured with custom allocators.

Changes:

  • Duplicate curl_easy_escape() output into tool-owned memory (curlx_strdup) and free the original with curl_free().
  • Ensure the returned pointer from data_urlencode() is consistently safe to free with the tool’s normal cleanup paths.

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

@bagder bagder closed this in 29dfc02 Mar 24, 2026
@bagder bagder deleted the bagder/urlencode-memory branch March 24, 2026 07:49
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