Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new PrincipalContext(ContextType.Machine) is not disposed at the end of the function #94772

Open
achufistov opened this issue Nov 15, 2023 · 3 comments

Comments

@achufistov
Copy link

achufistov commented Nov 15, 2023

Description

dotnet 6.0

File: /src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/User.cs:184

Problem: new PrincipalContext(ContextType.Machine) is not disposed at the end of the function

Reproduction Steps

  1. Role: detected
    detected
    [User.cs:[184:0]]

  2. Role: tracepoint
    2.1 Step 1: Condition Utils.IsSamUser() taking true branch
    [User.cs:[179:21]]
    2.2 created in constructor System.DirectoryServices.AccountManagement.PrincipalContext.PrincipalContext(System.DirectoryServices.AccountManagement.ContextType)
    [User.cs:[184:31]]
    2.3 no escape
    [User.cs:[184:31]]
    2.4 assigned
    [User.cs:[184:21]]
    2.5 no escape
    [User.cs:[215:28]]
    2.6 Step 2: Condition pSid != IntPtr.Zero taking any branch
    [User.cs:[219:25]]
    2.7 Step 3: Condition user == null taking false branch
    [User.cs:[225:21]]
    2.8 return
    [User.cs:[231:24]]

Expected behavior

memory leak

Actual behavior

memory leak

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

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

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Nov 15, 2023
@ghost
Copy link

ghost commented Nov 15, 2023

Tagging subscribers to this area: @dotnet/area-system-directoryservices, @jay98014
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

dotnet 6.0

File: /src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/User.cs

Problem: new PrincipalContext(ContextType.Machine) is not disposed at the end of the function

Reproduction Steps

  1. Role: detected
    detected
    [User.cs:[184:0]]

  2. Role: tracepoint
    2.1 Step 1: Condition Utils.IsSamUser() taking true branch
    [User.cs:[179:21]]
    2.2 created in constructor System.DirectoryServices.AccountManagement.PrincipalContext.PrincipalContext(System.DirectoryServices.AccountManagement.ContextType)
    [User.cs:[184:31]]
    2.3 no escape
    [User.cs:[184:31]]
    2.4 assigned
    [User.cs:[184:21]]
    2.5 no escape
    [User.cs:[215:28]]
    2.6 Step 2: Condition pSid != IntPtr.Zero taking any branch
    [User.cs:[219:25]]
    2.7 Step 3: Condition user == null taking false branch
    [User.cs:[225:21]]
    2.8 return
    [User.cs:[231:24]]

Expected behavior

memory leak

Actual behavior

memory leak

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

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

Author: achufistov
Assignees: -
Labels:

area-System.DirectoryServices

Milestone: -

@achufistov
Copy link
Author

I would like to suggest a pull request.

@buyaa-n
Copy link
Contributor

buyaa-n commented Jan 17, 2024

I would like to suggest a pull request.

Thank you @achufistov feel free to offer a fix, please cover fixes for #94774, #94777, #94771, #94775 and #94776 in it

@buyaa-n buyaa-n added this to the Future milestone Jan 17, 2024
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants