From: Ondřej Kuzník Date: Wed, 26 Nov 2025 13:55:54 +0000 (+0000) Subject: ITS#10408 Do not assume sop is still in the list X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9cb8701e3cf40510343a962256b711bd311f25ac;p=thirdparty%2Fopenldap.git ITS#10408 Do not assume sop is still in the list --- diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index 6f1eefbc35..a30b584e16 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -3340,12 +3340,15 @@ aband: ctxcsn[j].bv_val); bailout: if ( sop ) { - syncops **sp = &si->si_ops; + syncops **sp; ldap_pvt_thread_mutex_lock( &si->si_ops_mutex ); - while ( *sp != sop ) - sp = &(*sp)->s_next; - *sp = sop->s_next; + for ( sp = &si->si_ops; *sp; sp = &(*sp)->s_next ) { + if ( *sp == sop ) { + *sp = sop->s_next; + break; + } + } ldap_pvt_thread_mutex_unlock( &si->si_ops_mutex ); ch_free( sop->s_base.bv_val ); ch_free( sop );