]> git.sur5r.net Git - openldap/commitdiff
ITS#7292 more syncprov leaks
authorHoward Chu <hyc@openldap.org>
Thu, 7 Jun 2012 23:02:45 +0000 (16:02 -0700)
committerQuanah Gibson-Mount <quanah@openldap.org>
Fri, 8 Jun 2012 21:58:15 +0000 (14:58 -0700)
servers/slapd/overlays/syncprov.c

index 3a8c62649e3973005431ac19755123f319f979b5..11dcbc20f76809b74aa9085ec55221a1825a2837 100644 (file)
@@ -918,14 +918,16 @@ syncprov_qplay( Operation *op, syncops *so )
 
        do {
                ldap_pvt_thread_mutex_lock( &so->s_mutex );
+               /* Exit loop with mutex held */
+               if ( so->s_op->o_abandon )
+                       break;
                sr = so->s_res;
-               if ( sr )
-                       so->s_res = sr->s_next;
-               if ( !so->s_res )
-                       so->s_restail = NULL;
                /* Exit loop with mutex held */
-               if ( !sr || so->s_op->o_abandon )
+               if ( !sr )
                        break;
+               so->s_res = sr->s_next;
+               if ( !so->s_res )
+                       so->s_restail = NULL;
                ldap_pvt_thread_mutex_unlock( &so->s_mutex );
 
                if ( sr->s_mode == LDAP_SYNC_NEW_COOKIE ) {