Skip to content

tool_doswin: avoid memory-leak with CURL_FN_SANITIZE_*#20804

Closed
bagder wants to merge 1 commit intomasterfrom
bagder/doswin-debug-leak
Closed

tool_doswin: avoid memory-leak with CURL_FN_SANITIZE_*#20804
bagder wants to merge 1 commit intomasterfrom
bagder/doswin-debug-leak

Conversation

@bagder
Copy link
Copy Markdown
Member

@bagder bagder commented Mar 3, 2026

This is debug-only code

Follow-up to 20900e4

Found by Codex Security

This is debug-only code

Follow-up to 20900e4

Found by Codex Security
@github-actions github-actions bot added the Windows Windows-specific label Mar 3, 2026
@bagder bagder requested a review from Copilot March 3, 2026 22:17
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 updates the Windows/MS-DOS filename sanitization helper to avoid leaking the allocated target buffer when debug-only environment-variable fault injection paths are triggered.

Changes:

  • Free target before returning from the CURL_FN_SANITIZE_BAD debug-injection error path.
  • Free target before returning from the CURL_FN_SANITIZE_OOM debug-injection error path.
  • Add braces around the debug-only if(getenv(...)) blocks to safely include cleanup.

💡 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.

@bagder bagder marked this pull request as ready for review March 6, 2026 21:47
@bagder bagder closed this in d7e4473 Mar 6, 2026
@bagder bagder deleted the bagder/doswin-debug-leak branch March 6, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cmdline tool Windows Windows-specific

Development

Successfully merging this pull request may close these issues.

3 participants