[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#6453) OpenLDAP memory leak on LDAP_TIMEOUT



Buna ziua, domnule.

1. The pointer must be checked before operation, e.g.
if (res != NULL) {
    ldap_msgfree (res);
    res = NULL;
}

2. Also while processing the ext query, you should call the functions in
the following manner:
2.1 ldap_search_ext() which has pointer to msgid
2.2 ldap_result() which gives the LDAPMessage structure for the msgid
2.3 if ok - ldap_parse_result()
2.4 on any stage if something is not good and you have the msgid filled
with value (integer, typicaly more then 1) you should call
ldap_abandon_ext() for that msgid
2.5 Finish with ldap_msgfree()

3. Periodically between the asynchronous searches (after 100 for
example)you should call ldap_result() with short timer and LDAP_RES_ANY
argue for clearing stalled or nonfreed calls. The obtained LDAPMessage can
be freed with ldap_msgfree(). Of course, you can count the asynch calls
which hadn't been completed or were timed out and you can make the
corresponding cycle for checking all iterations.

Please try and let me know.

With respect, Serghei.