Skip to content

Commit

Permalink
Fix: resources leak in ActiveDirectorySchemaClass in GetPropertyValue…
Browse files Browse the repository at this point in the history
…sRecursively
  • Loading branch information
sancheolz committed Mar 11, 2024
1 parent 4c39348 commit 1badcdc
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 1badcdc

Please sign in to comment.