Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
Client-side memory management depends on the specific LDAP functions. In general, you need to free the memory associated with data that was returned to the client either as an out parameter or as a function return value. However, some functions, such as ldap_err2string, return a pointer to a static buffer, and in that case you should not free the memory associated with the returned data.
The Microsoft LDAP API supports the following memory management functions. For specific information on managing memory for a particular function, see the reference page for that function.
The ldap_memfreefunction frees memory that was allocated from the LDAP heap. Call this function to free strings, such as the distinguished name returned by ldap_get_dnand the ErrorMessageand MatchedDNSparameters in ldap_parse_result.
The ldap_value_freefunction frees the character string returned by ldap_get_values. Call ldap_value_free_lento free the bervalstructures returned by ldap_get_values_len.
Call the ldap_control_freefunction to dispose of a previously allocated LDAPControlstructure. Call ldap_controls_freeto dispose of a previously allocated array of LDAPControlstructures.
Call ldap_msgfreeto dispose of an LDAPMessagestructure, such as the one the server returns in a call to ldap_first_reference.