Skip to content

Commit

Permalink
Fix: resources leak in ActiveDirectorySchemaClass in GetPropertyValue…
Browse files Browse the repository at this point in the history
…sRecursively (dotnet#99526)
  • Loading branch information
sancheolz authored Mar 14, 2024
1 parent ca905a2 commit ce47d49
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ private ArrayList GetPropertyValuesRecursively(string[] propertyNames)
// get the properties of the auxiliary classes
foreach (string auxSchemaClassName in GetValuesFromCache(PropertyManager.AuxiliaryClass))
{
ActiveDirectorySchemaClass auxSchemaClass = new ActiveDirectorySchemaClass(_context, auxSchemaClassName, (DirectoryEntry?)null, null);
using ActiveDirectorySchemaClass auxSchemaClass = new ActiveDirectorySchemaClass(_context, auxSchemaClassName, (DirectoryEntry?)null, null);

foreach (string property in auxSchemaClass.GetPropertyValuesRecursively(propertyNames))
{
Expand All @@ -1441,8 +1441,7 @@ private ArrayList GetPropertyValuesRecursively(string[] propertyNames)
}
foreach (string auxSchemaClassName in GetValuesFromCache(PropertyManager.SystemAuxiliaryClass))
{
ActiveDirectorySchemaClass auxSchemaClass = new ActiveDirectorySchemaClass(_context, auxSchemaClassName, (DirectoryEntry?)null, null);

using ActiveDirectorySchemaClass auxSchemaClass = new ActiveDirectorySchemaClass(_context, auxSchemaClassName, (DirectoryEntry?)null, null);
foreach (string property in auxSchemaClass.GetPropertyValuesRecursively(propertyNames))
{
if (!values.Contains(property))
Expand Down

0 comments on commit ce47d49

Please sign in to comment.