Re: LDAP core dump followup
| From: | Amitay Isaacs | Date: | Tue, 11 Aug 1998 06:54:51 +0000 |
| Subject: | Re: LDAP core dump followup | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-90@lists.php.net to get a copy of this message | ||
Hi,
| I am not extremely familiar with the LDAP API, but we have something that
| doesn't look quite right here. The le_result_entry list type has no
| destructor.
|
| php3_ldap_module.le_result = register_list_destructors(_free_ldap_result,
| -- NULL);
| php3_ldap_module.le_result_entry = register_list_destructors(NULL, NULL);
This looks correct to me since ldap server only allocates memory for
LDAPMessage data structure. All the methods for reading the entires just
iterate thru the result data. So we don't need any special list destructor
for result_entry other than removing the result_entry from hash.
| Yet, there is an user-level ldap_free_entry() function which ends up
| calling ldap_msgfree() in the LDAP API. If I call ldap_free_entry() on an
| entry and then call ldap_free_result() on the result this entry came from,
| then I get the core dump I posted before. If I leave out the
| ldap_free_result() call from my script, then I of course just get the core
| dump at the end of the script when the destructor for the result list is
| called.
I guess the ideal solution would be removing the user level calls
ldap_free_entry() and ldap_free_result(). Since ldap_msgfree() gets called
in the destructor of the result, freeing all the memory allocated.
| It seems to me that a result_entry element either should not be freed or
| we are freeing it the wrong way. Looking through RFC 1823 I don't see any
| indication that an entry should be freed. A result pointer needs to be
| freed and that is documented in the RFC.
Right. So we just need to have a destructor which calls ldap_msgfree() and
remove the user-level calls.
| Please correct me if I am wrong on this.
|
| And if this is the correct patch, should we not remove the
| ldap_free_entry() function completely? I don't see what purpose it
| serves.
I am removing both the functions.
Amitay.
--
I reach a conclusion whenever I am tired of thinking.
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net