+ /* Do final delete cleanup */
+ if ( !si->si_ctype ) {
+ cookie_state *cs = NULL;
+ syncinfo_t **sip;
+
+ cs = be->be_syncinfo->si_cookieState;
+ for ( sip = &be->be_syncinfo; *sip != si; sip = &(*sip)->si_next );
+ *sip = si->si_next;
+ syncinfo_free( si );
+ if ( !be->be_syncinfo ) {
+ SLAP_DBFLAGS( be ) &= ~(SLAP_DBFLAG_SHADOW|SLAP_DBFLAG_SYNC_SHADOW);
+ if ( cs ) {
+ ber_bvarray_free( cs->cs_vals );
+ ldap_pvt_thread_mutex_destroy( &cs->cs_mutex );
+ ch_free( cs );
+ }
+ }
+ }