Closing a Connection
A version of this page is also available for
4/8/2010
When an LDAP client has finished communicating with a server, and all necessary memory cleanup is complete, call ldap_unbind or ldap_unbind_s to unbind from the directory, close the connection, and dispose of the session handle. Call one of these functions whenever you have finished with a connection, even if you have not explicitly called a bind function to open the connection.
Both ldap_unbind and ldap_unbind_s work synchronously. There is no server response to an unbind operation. Make sure that you do not inadvertently call either unbind function more than once on a session handle because doing so can free resources that you did not intend to free.