Commit d41b7b31 authored by Quanah Gibson-Mount's avatar Quanah Gibson-Mount
Browse files

More for ITS#6011

parent 467e3b13
......@@ -1261,6 +1261,8 @@ do_syncrepl(
if ( si == NULL )
return NULL;
if ( slapd_shutdown )
return NULL;
Debug( LDAP_DEBUG_TRACE, "=>do_syncrepl %s\n", si->si_ridtxt, 0, 0 );
......@@ -3602,13 +3604,6 @@ syncinfo_free( syncinfo_t *sie, int free_all )
Debug( LDAP_DEBUG_TRACE, "syncinfo_free: %s\n",
sie->si_ridtxt, 0, 0 );
sie->si_cookieState->cs_ref--;
if ( !sie->si_cookieState->cs_ref ) {
ch_free( sie->si_cookieState->cs_sids );
ber_bvarray_free( sie->si_cookieState->cs_vals );
ldap_pvt_thread_mutex_destroy( &sie->si_cookieState->cs_mutex );
ch_free( sie->si_cookieState );
}
do {
si_next = sie->si_next;
......@@ -3620,20 +3615,21 @@ syncinfo_free( syncinfo_t *sie, int free_all )
ldap_unbind_ext( sie->si_ld, NULL, NULL );
}
/* re-fetch it, in case it was already removed */
ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
sie->si_re = ldap_pvt_runqueue_find( &slapd_rq, do_syncrepl, sie );
if ( sie->si_re ) {
if ( ldap_pvt_runqueue_isrunning( &slapd_rq, sie->si_re ) )
ldap_pvt_runqueue_stoptask( &slapd_rq, sie->si_re );
ldap_pvt_runqueue_remove( &slapd_rq, sie->si_re );
struct re_s *re = sie->si_re;
sie->si_re = NULL;
ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
if ( ldap_pvt_runqueue_isrunning( &slapd_rq, re ) )
ldap_pvt_runqueue_stoptask( &slapd_rq, re );
ldap_pvt_runqueue_remove( &slapd_rq, re );
ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
}
ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
ldap_pvt_thread_mutex_destroy( &sie->si_mutex );
ldap_pvt_thread_mutex_destroy( &sie->si_mutex );
bindconf_free( &sie->si_bindconf );
if ( sie->si_filterstr.bv_val ) {
ch_free( sie->si_filterstr.bv_val );
}
......@@ -3709,6 +3705,13 @@ syncinfo_free( syncinfo_t *sie, int free_all )
}
ch_free( npe );
}
sie->si_cookieState->cs_ref--;
if ( !sie->si_cookieState->cs_ref ) {
ch_free( sie->si_cookieState->cs_sids );
ber_bvarray_free( sie->si_cookieState->cs_vals );
ldap_pvt_thread_mutex_destroy( &sie->si_cookieState->cs_mutex );
ch_free( sie->si_cookieState );
}
ch_free( sie );
sie = si_next;
} while ( free_all && si_next );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment