8000 [LDAP] Free the search result after a search to free memory · symfony/symfony@98cbd31 · GitHub
[go: up one dir, main page]

Skip to content

Commit 98cbd31

Browse files
committed
[LDAP] Free the search result after a search to free memory
Fixed error handling in ldap_search and ldap_free Added spaces around if
1 parent cd86797 commit 98cbd31

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Symfony/Component/Ldap/LdapClient.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,17 @@ public function find($dn, $query, $filter = '*')
8484
}
8585

8686
$search = ldap_search($this->connection, $dn, $query, $filter);
87+
88+
if (false === $search) {
89+
throw new LdapException(ldap_error($this->connection));
90+
}
91+
8792
$infos = ldap_get_entries($this->connection, $search);
8893

94+
if (false === @ldap_free_result($search)) {
95+
throw new LdapException(ldap_error($this->connection));
96+
}
97+
8998
if (0 === $infos['count']) {
9099
return;
91100
}

0 commit comments

Comments
 (0)
0