Skip to content

Commit

Permalink
Merge pull request #660 from ivassile/ELY-924
Browse files Browse the repository at this point in the history
[ELY-924] Coverity static analysis: Resource leak in LdapSecurityRealm (Elytron)
  • Loading branch information
darranl committed Feb 6, 2017
2 parents c384df3 + 19098cd commit 34fe399
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -627,10 +627,9 @@ private LdapIdentity getIdentity() throws RealmUnavailableException {

ldapSearch.setReturningAttributes(); // no attributes needed

try (
Stream<LdapIdentity> identityStream = ldapSearch.search(context)
.map(result -> new LdapIdentity(result.getNameInNamespace()))
) {
try (Stream<SearchResult> ldapSearchStream = ldapSearch.search(context);
Stream<LdapIdentity> identityStream = ldapSearchStream
.map(result -> new LdapIdentity(result.getNameInNamespace()))) {
LdapIdentity identity = identityStream.findFirst().orElse(null);
if (identity != null) {
log.debugf("Identity for principal [%s] found at [%s].", name, identity.getDistinguishedName());
Expand Down

0 comments on commit 34fe399

Please sign in to comment.