]> git.sur5r.net Git - openldap/commitdiff
ITS#7402 fix potential txn leak in online indexer
authorHoward Chu <hyc@openldap.org>
Sat, 20 Oct 2012 16:27:23 +0000 (09:27 -0700)
committerHoward Chu <hyc@openldap.org>
Sat, 20 Oct 2012 16:27:23 +0000 (09:27 -0700)
servers/slapd/back-bdb/config.c

index d12e5d8091d438640b29faac565e63a24b7ad888..0a680032c037455d648da06d83b4a038da6dcf89 100644 (file)
@@ -284,17 +284,16 @@ bdb_online_index( void *ctx, void *arg )
                }
                if ( ei->bei_e ) {
                        rc = bdb_index_entry( op, txn, BDB_INDEX_UPDATE_OP, ei->bei_e );
-                       if ( rc == DB_LOCK_DEADLOCK ) {
+                       if ( rc ) {
                                TXN_ABORT( txn );
-                               ldap_pvt_thread_yield();
-                               continue;
-                       }
-                       if ( rc == 0 ) {
-                               rc = TXN_COMMIT( txn, 0 );
-                               txn = NULL;
-                       }
-                       if ( rc )
+                               if ( rc == DB_LOCK_DEADLOCK ) {
+                                       ldap_pvt_thread_yield();
+                                       continue;
+                               }
                                break;
+                       }
+                       rc = TXN_COMMIT( txn, 0 );
+                       txn = NULL;
                }
                id++;
                getnext = 1;