Skip to content

doh: fix memory-leak when doing a second DoH resolve#20929

Closed
bagder wants to merge 1 commit intomasterfrom
bagder/doh-free
Closed

doh: fix memory-leak when doing a second DoH resolve#20929
bagder wants to merge 1 commit intomasterfrom
bagder/doh-free

Conversation

@bagder
Copy link
Copy Markdown
Member

@bagder bagder commented Mar 15, 2026

Reported-by: James Fuller

@bagder bagder added memory-leak name lookup DNS and related tech labels Mar 15, 2026
@testclutch
Copy link
Copy Markdown

Analysis of PR #20929 at fb794474:

Test ../../tests/http/test_05_errors.py::TestErrors::test_05_01_partial_1[h3] failed, but it has been 1.6% 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).

Generated by Testclutch

@bagder bagder requested a review from Copilot March 15, 2026 17:01
@bagder bagder marked this pull request as ready for review March 15, 2026 17:01
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 a memory leak in the DoH (DNS-over-HTTPS) resolver path when Curl_doh() is invoked multiple times on the same easy handle by freeing the previously stored async hostname before storing the new one.

Changes:

  • Free data->state.async.hostname before overwriting it in Curl_doh() to prevent leaking the prior allocation.

💡 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 closed this in 32531f2 Mar 15, 2026
@bagder bagder deleted the bagder/doh-free branch March 16, 2026 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

memory-leak name lookup DNS and related tech

Development

Successfully merging this pull request may close these issues.

3 participants