]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/unbind.c
Merge remote branch 'origin/mdb.master' into OPENLDAP_REL_ENG_2_4
[openldap] / libraries / libldap / unbind.c
index 35a92a8d7e8b1eea2fad297e19d6c678d308fbe3..cd293d2609db3e09db5ce2ee30592bb7356780bb 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2012 The OpenLDAP Foundation.
+ * Copyright 1998-2013 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -129,6 +129,9 @@ ldap_ld_free(
                ld->ld_abandoned = NULL;
        }
        LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
+
+       ber_sockbuf_free( ld->ld_sb );
+
        LDAP_MUTEX_LOCK( &ld->ld_ldopts_mutex );
 
        /* final close callbacks */
@@ -217,8 +220,6 @@ ldap_ld_free(
        }
        LDAP_MUTEX_UNLOCK( &ld->ld_ldopts_mutex );
 
-       ber_sockbuf_free( ld->ld_sb );   
-   
 #ifdef LDAP_R_COMPILE
        ldap_pvt_thread_mutex_destroy( &ld->ld_msgid_mutex );
        ldap_pvt_thread_mutex_destroy( &ld->ld_conn_mutex );