Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 1 commit into from
Apr 13, 2016
Merged

[LDAP] Free the search result after a search to free memory #18490

merged 1 commit into from
Apr 13, 2016

Conversation

hiddewie
Copy link
Contributor

@hiddewie 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

@fabpot
Copy link
Member

fabpot commented Apr 11, 2016

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);
Copy link
Contributor

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.

@hiddewie
Copy link
Contributor Author

I've updated the code to check for errors during the search of free.

@csarrazi
Copy link
Contributor

👍

@@ -84,8 +84,15 @@ public function find($dn, $query, $filter = '*')
}

$search = ldap_search($this->connection, $dn, $query, $filter);
if (false === $search) {
Copy link
Contributor

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.

@csarrazi
Copy link
Contributor

LGTM. Just 2 comments regarding style, so it is consistent with the rest.

@hiddewie
Copy link
Contributor Author

I've updated the spacing.

@csarrazi
Copy link
Contributor

By the way, could you add a few functional tests?

@hiddewie
Copy link
Contributor Author

I've added a find test and a few for checking the (new) exceptions.

I hope the Travis test-config is correct (taken from the master branch), I do not have a lot of experience in that area.

@csarrazi
Copy link
Contributor

Nevermind my comment.

I thought you were in the master branch. Could you revert the last commit, then squash your all your commits in a single one? Thanks!

While we could add functional tests, these will most likely break when merging back to the master branch.

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.
@hiddewie
Copy link
Contributor Author

Yes, reverted last commits.

@csarrazi
Copy link
Contributor

👍

@fabpot
Copy link
Member

fabpot commented Apr 13, 2016

Thank you @hiddewie.

@fabpot fabpot merged commit 7da4453 into symfony:2.8 Apr 13, 2016
fabpot added a commit that referenced this pull request Apr 13, 2016
…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
This was referenced Apr 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants