Skip to content

Fix Handle Leak#126193

Merged
MichalStrehovsky merged 2 commits into
dotnet:mainfrom
AristidesASm:HANDLE_LEAK-JsonDocument.Parse
Mar 30, 2026
Merged

Fix Handle Leak#126193
MichalStrehovsky merged 2 commits into
dotnet:mainfrom
AristidesASm:HANDLE_LEAK-JsonDocument.Parse

Conversation

@AristidesASm

Copy link
Copy Markdown
Contributor

HANDLE_LEAK JsonDocument.Parse(json, new JsonDocumentOptions() { AllowTrailingCommas = true }) becomes out of scope and is not disposed

A copy of the string is extracted from the object (jsonDocument.RootElement.....Value.EnumerateObject()->Value.GetString()) , so it is not needed when the method completes. 'using' operator is safe here.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Mar 27, 2026

@MichalStrehovsky MichalStrehovsky left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cc @tmat, this file is just a copy https://github.com/dotnet/sourcelink/blob/main/src/SourceLink.Tools/SourceLinkMap.cs fixed up not to trigger warnings in our build, we don't really want to maintain it.

@MichalStrehovsky

Copy link
Copy Markdown
Member

/ba-g timeout in an unrelated leg

@MichalStrehovsky MichalStrehovsky merged commit fc42ca6 into dotnet:main Mar 30, 2026
103 of 106 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-ReadyToRun community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants