Skip to content

Commit

Permalink
HPCC-32039 Protect against potential leaks in the LDAP code
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday committed Jun 11, 2024
1 parent 5d8af35 commit c748ec3
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions system/security/LdapSecurity/ldapsecurity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1272,8 +1272,7 @@ IAuthMap * CLdapSecManager::createAuthMap(IPropertyTree * authconfig, IEspSecure
{
CAuthMap* authmap = new CAuthMap();

IPropertyTreeIterator *loc_iter = NULL;
loc_iter = authconfig->getElements(".//Location");
Owned<IPropertyTreeIterator> loc_iter(authconfig->getElements(".//Location"));
if (loc_iter != NULL)
{
IPropertyTree *location = NULL;
Expand Down Expand Up @@ -1308,8 +1307,6 @@ IAuthMap * CLdapSecManager::createAuthMap(IPropertyTree * authconfig, IEspSecure
}
loc_iter->next();
}
loc_iter->Release();
loc_iter = NULL;
}

authmap->shareWithManager(*this, secureContext);
Expand All @@ -1322,8 +1319,7 @@ IAuthMap * CLdapSecManager::createFeatureMap(IPropertyTree * authconfig, IEspSec
{
CAuthMap* feature_authmap = new CAuthMap();

IPropertyTreeIterator *feature_iter = NULL;
feature_iter = authconfig->getElements(".//Feature");
Owned<IPropertyTreeIterator> feature_iter(authconfig->getElements(".//Feature"));
if (feature_iter != NULL)
{
IPropertyTree *feature = NULL;
Expand Down Expand Up @@ -1355,8 +1351,6 @@ IAuthMap * CLdapSecManager::createFeatureMap(IPropertyTree * authconfig, IEspSec
}
feature_iter->next();
}
feature_iter->Release();
feature_iter = NULL;
}

feature_authmap->shareWithManager(*this, secureContext);
Expand Down Expand Up @@ -1652,9 +1646,7 @@ LDAPSECURITY_API IAuthMap *newDefaultAuthMap(IPropertyTree* config)
{
CAuthMap* authmap = new CAuthMap();

IPropertyTreeIterator *loc_iter = NULL;
loc_iter = config->getElements(".//Location");

Owned<IPropertyTreeIterator> loc_iter(config->getElements(".//Location"));
if (loc_iter != NULL)
{
IPropertyTree *location = NULL;
Expand All @@ -1677,7 +1669,6 @@ LDAPSECURITY_API IAuthMap *newDefaultAuthMap(IPropertyTree* config)
loc_iter->next();
}
loc_iter->Release();
loc_iter = NULL;
}

return authmap;
Expand Down

0 comments on commit c748ec3

Please sign in to comment.