-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[LDAP] Free the search result after a search to free memory #18490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
hiddewie
commented
Apr 9, 2016
Q | A |
---|---|
Branch? | 2.8 |
Bug fix? | yes |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | |
License | MIT |
Doc PR |
ping @csarrazi |
@@ -86,6 +86,8 @@ public function find($dn, $query, $filter = '*') | |||
$search = ldap_search($this->connection, $dn, $query, $filter); | |||
$infos = ldap_get_entries($this->connection, $search); | |||
|
|||
ldap_free_result($search); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ldap_free_results
won't work if the ldap_search
method call returns false
or throws an error.
You should add some error handling code around the statement.
I've updated the code to check for errors during the search of free. |
👍 |
@@ -84,8 +84,15 @@ public function find($dn, $query, $filter = '*') | |||
} | |||
|
|||
$search = ldap_search($this->connection, $dn, $query, $filter); | |||
if (false === $search) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add newline before the if
statement.
LGTM. Just 2 comments regarding style, so it is consistent with the rest. |
I've updated the spacing. |
By the way, could you add a few functional tests? |
I've added a I hope the Travis test-config is correct (taken from the |
Nevermind my comment. I thought you were in the While we could add functional tests, these will most likely break when merging back to the |
Fixed error handling in ldap_search and ldap_free Added spaces around if Fixed trailing spaces Added functional tests for Ldap component Fixed style errors Fixed style errors 2 Added slapd to Travis requirements Added mkdir /tmp/travis to Travis build config Revert "Added mkdir /tmp/travis to Travis build config" This reverts commit d7f1884. Revert "Added slapd to Travis requirements" This reverts commit 9b212ff. Revert "Fixed style errors 2" This reverts commit cbe0c16. Revert "Fixed style errors" This reverts commit a2dc110. Revert "Added functional tests for Ldap component" This reverts commit 33a6723.
Yes, reverted last commits. |
👍 |
Thank you @hiddewie. |
…y (hiddewie) This PR was merged into the 2.8 branch. Discussion ---------- [LDAP] Free the search result after a search to free memory | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Commits ------- 7da4453 [LDAP] Free the search result after a search to free memory