次の方法で共有


Managing Memory (Windows Embedded CE 6.0)

1/6/2010

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_memfree function frees memory that was allocated from the LDAP heap. Call this function to free strings, such as the distinguished name returned by ldap_get_dn and the ErrorMessage and MatchedDNS parameters in ldap_parse_result.

The ldap_value_free function frees the character string returned by ldap_get_values. Call ldap_value_free_len to free the berval structures returned by ldap_get_values_len.

Call the ldap_control_free function to dispose of a previously allocated LDAPControl structure. Call ldap_controls_free to dispose of a previously allocated array of LDAPControl structures.

Call ldap_msgfree to dispose of an LDAPMessage structure, such as the one the server returns in a call to ldap_first_reference.

See Also

Concepts

Using the LDAP API