Skip to content

SDSUtils.BuildDirectoryEntry( "LDAP://" + this.dnsHostName + "/" + this.defaultNamingContext, this.credentials, this.authTypes) is not disposed at the end of the function #94775

@achufistov

Description

@achufistov

Description

dotnet 6.0

File: /src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx.cs:2526

Problem: SDSUtils.BuildDirectoryEntry( "LDAP://" + this.dnsHostName + "/" + this.defaultNamingContext, this.credentials, this.authTypes) is not disposed at the end of the function

Reproduction Steps

  1. Role: detected
    detected
    [ADStoreCtx.cs:[2526:0]]

  2. Role: tracepoint
    2.1 Step 1: Entering the foreach
    [ADStoreCtx.cs:[2460:46]]
    2.2 Step 2: Condition component.Length > 3 taking any branch
    [ADStoreCtx.cs:[2463:26]]
    2.3 Step 3: Entering the foreach
    [ADStoreCtx.cs:[2460:46]]
    2.4 Step 4: Condition component.Length > 3 taking any branch
    [ADStoreCtx.cs:[2463:26]]
    2.5 Step 5: Entering the foreach
    [ADStoreCtx.cs:[2460:46]]
    2.6 Step 6: Condition component.Length > 3 taking any branch
    [ADStoreCtx.cs:[2463:26]]
    2.7 Step 7: Exiting the foreach
    [ADStoreCtx.cs:[2460:46]]
    2.8 Step 8: Condition ncComponents is null taking any branch
    [ADStoreCtx.cs:[2460:46]]
    2.9 Step 9: Condition dnsDomainName.Length > 0 taking true branch
    [ADStoreCtx.cs:[2474:21]]
    2.10 Step 10: Condition rootDse = new DirectoryEntry("LDAP://" + this.dnsHostName + "/rootDse", "", "", AuthenticationTypes.Anonymous) is null taking any branch
    [ADStoreCtx.cs:[2449:35]]
    2.11 created in method System.DirectoryServices.AccountManagement.SDSUtils.BuildDirectoryEntry(string, System.DirectoryServices.AccountManagement.NetCred, System.DirectoryServices.AuthenticationTypes)
    [ADStoreCtx.cs:[2526:39]]
    2.12 assigned
    [ADStoreCtx.cs:[2526:28]]
    2.13 no escape
    [ADStoreCtx.cs:[2532:13]]
    2.14 no escape
    [ADStoreCtx.cs:[2534:17]]
    2.15 Step 11: Condition domainNC.Properties["lockoutDuration"].Count > 0 taking true branch
    [ADStoreCtx.cs:[2534:17]]
    2.16 no escape
    [ADStoreCtx.cs:[2536:30]]
    2.17 no escape
    [ADStoreCtx.cs:[2537:110]]

  3. Role: debug
    3.1 System.DirectoryServices.AccountManagement.GlobalDebug.Info.get invocation is a back edge
    [ADStoreCtx.cs:[2435:37]]
    3.2 System.DirectoryServices.AccountManagement.GlobalDebug.Info.get invocation is a back edge
    [ADStoreCtx.cs:[2478:41]]
    3.3 System.ComponentModel.Component.Dispose() invocation is a back edge
    [ADStoreCtx.cs:[2449:35]]
    3.4 System.DirectoryServices.AccountManagement.GlobalDebug.Info.get invocation is a back edge
    [ADStoreCtx.cs:[2514:37]]
    3.5 System.DirectoryServices.AccountManagement.GlobalDebug.Info.get invocation is a back edge
    [ADStoreCtx.cs:[2542:41]]
    3.6 System.DirectoryServices.AccountManagement.GlobalDebug.Info.get invocation is a back edge
    [ADStoreCtx.cs:[2556:41]]
    3.7 System.DirectoryServices.AccountManagement.GlobalDebug.Info.get invocation is a back edge
    [ADStoreCtx.cs:[2563:45]]
    3.8 System.ComponentModel.Component.Dispose() invocation is a back edge
    [ADStoreCtx.cs:[2449:35]]
    3.9 System.DirectoryServices.AccountManagement.GlobalDebug.Info.get invocation is a back edge
    [ADStoreCtx.cs:[2478:41]]
    3.10 System.ComponentModel.Component.Dispose() invocation is a back edge
    [ADStoreCtx.cs:[2449:35]]
    3.11 System.DirectoryServices.AccountManagement.GlobalDebug.Info.get invocation is a back edge
    [ADStoreCtx.cs:[2514:37]]
    3.12 System.DirectoryServices.AccountManagement.GlobalDebug.Info.get invocation is a back edge
    [ADStoreCtx.cs:[2542:41]]
    3.13 System.DirectoryServices.AccountManagement.GlobalDebug.Info.get invocation is a back edge
    [ADStoreCtx.cs:[2556:41]]
    3.14 System.DirectoryServices.AccountManagement.GlobalDebug.Info.get invocation is a back edge
    [ADStoreCtx.cs:[2563:45]]
    3.15 System.DirectoryServices.AccountManagement.GlobalDebug.Info.get invocation is a back edge
    [ADStoreCtx.cs:[2478:41]]
    3.16 System.ComponentModel.Component.Dispose() invocation is a back edge
    [ADStoreCtx.cs:[2449:35]]
    3.17 System.DirectoryServices.AccountManagement.GlobalDebug.Info.get invocation is a back edge
    [ADStoreCtx.cs:[2514:37]]
    3.18 System.DirectoryServices.AccountManagement.GlobalDebug.Info.get invocation is a back edge
    [ADStoreCtx.cs:[2542:41]]
    3.19 System.DirectoryServices.AccountManagement.GlobalDebug.Info.get invocation is a back edge
    [ADStoreCtx.cs:[2556:41]]
    3.20 System.DirectoryServices.AccountManagement.GlobalDebug.Info.get invocation is a back edge
    [ADStoreCtx.cs:[2563:45]]

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions