if ( sb->sb_options & (LBER_TO_FILE | LBER_TO_FILE_ONLY) ) {
rc = write( sb->sb_fd, ber->ber_rwptr, towrite );
if ( sb->sb_options & LBER_TO_FILE_ONLY ) {
+ if ( freeit )
+ ber_free( ber, 1 );
return( (int)rc );
}
}
#endif
c->c_sb = ber_sockbuf_alloc( );
+ c->c_currentber = NULL;
/* should check status of thread calls */
ldap_pvt_thread_mutex_init( &c->c_mutex );
#ifdef HAVE_CYRUS_SASL
assert( c->c_sasl_context == NULL );
#endif
+ assert( c->c_currentber == NULL );
c->c_listener_url = ch_strdup( url );
c->c_peer_domain = ch_strdup( dnsname );
}
#endif
+ if ( c->c_currentber != NULL ) {
+ ber_free( c->c_currentber, 1 );
+ c->c_currentber = NULL;
+ }
+
if ( ber_pvt_sb_in_use(c->c_sb) ) {
int sd = ber_pvt_sb_get_desc(c->c_sb);
if ( connection_state_closing( conn ) ) {
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
ldap_pvt_thread_mutex_unlock( &conn->c_write_mutex );
+
return 0;
}
- if ( ber_flush( conn->c_sb, ber, 1 ) == 0 ) {
+ if ( ber_flush( conn->c_sb, ber, 0 ) == 0 ) {
break;
}
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
ldap_pvt_thread_mutex_unlock( &conn->c_write_mutex );
+
return( -1 );
}
if ( rc == -1 ) {
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
+ ber_free( ber, 1 );
return;
}
/* send BER */
bytes = send_ldap_ber( conn, ber );
+ ber_free( ber, 1 );
if ( bytes < 0 ) {
Debug( LDAP_DEBUG_ANY,
}
bytes = send_ldap_ber( conn, ber );
+ ber_free( ber, 1 );
if ( bytes < 0 ) {
Debug( LDAP_DEBUG_ANY,
}
bytes = send_ldap_ber( conn, ber );
+ ber_free( ber, 1 );
ldap_pvt_thread_mutex_lock( &num_sent_mutex );
num_bytes_sent += bytes;