]> git.sur5r.net Git - openldap/commitdiff
ITS#8354 tweak prev commit
authorHoward Chu <hyc@openldap.org>
Fri, 22 Jan 2016 20:46:23 +0000 (20:46 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 22 Jan 2016 20:46:23 +0000 (20:46 +0000)
Delay mutex init to avoid leaking the mutex

servers/slapd/overlays/syncprov.c

index 9affd0ee67ef2d3e2f6461acb3f5d015753a8e27..583f29b6a8747ecf098f6cf75391456c78b7a5b8 100644 (file)
@@ -2544,7 +2544,6 @@ syncprov_op_search( Operation *op, SlapReply *rs )
                }
                sop = ch_malloc( sizeof( syncops ));
                *sop = so;
-               ldap_pvt_thread_mutex_init( &sop->s_mutex );
                sop->s_rid = srs->sr_state.rid;
                sop->s_sid = srs->sr_state.sid;
                /* set refcount=2 to prevent being freed out from under us
@@ -2574,6 +2573,7 @@ syncprov_op_search( Operation *op, SlapReply *rs )
                                ldap_pvt_thread_yield();
                        ldap_pvt_thread_mutex_lock( &si->si_ops_mutex );
                }
+               ldap_pvt_thread_mutex_init( &sop->s_mutex );
                sop->s_next = si->si_ops;
                sop->s_si = si;
                si->si_ops = sop;