]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#10003: ldap_open_internal_connection: fix mutex usage
authorHoward Chu <hyc@openldap.org>
Thu, 2 Feb 2023 15:28:22 +0000 (15:28 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Wed, 26 Apr 2023 17:32:45 +0000 (17:32 +0000)
Note: this is a non-standard function with no use cases

libraries/libldap/open.c

index afef818d460105304c2e9f3b19706590da4c96df..deb8c2fe4ae6f580ff93f731810852bff2da8b6a 100644 (file)
@@ -585,9 +585,9 @@ ldap_open_internal_connection( LDAP **ldp, ber_socket_t *fdp )
        /* Attach the passed socket as the *LDAP's connection */
        c = ldap_new_connection( ld, NULL, 1, 0, NULL, 0, 0 );
        if( c == NULL ) {
+               LDAP_MUTEX_UNLOCK( &ld->ld_conn_mutex );
                ldap_unbind_ext( ld, NULL, NULL );
                *ldp = NULL;
-               LDAP_MUTEX_UNLOCK( &ld->ld_conn_mutex );
                return( LDAP_NO_MEMORY );
        }
        ber_sockbuf_ctrl( c->lconn_sb, LBER_SB_OPT_SET_FD, fdp );