Skip to content

tool_doswin: avoid memory-leak with CURL_FN_SANITIZE_* - #20804

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

bagder wants to merge 1 commit into
masterfrom
bagder/doswin-debug-leak

Conversation

@bagder

@bagder bagder commented Mar 3, 2026

Copy link
Copy Markdown
Member

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

Copilot AI left a comment

Copy link
Copy Markdown

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
outcast36 pushed a commit to greearb/curl that referenced this pull request Jun 3, 2026
This is debug-only code

Follow-up to 20900e4

Found by Codex Security

Closes curl#20804
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