]> git.sur5r.net Git - openldap/commitdiff
cleanup db_close
authorHoward Chu <hyc@openldap.org>
Tue, 20 Dec 2005 00:55:39 +0000 (00:55 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 20 Dec 2005 00:55:39 +0000 (00:55 +0000)
servers/slapd/back-bdb/init.c

index 989b467e375ee259091fcf2c2824eebc6193b08c..e9bbf375ace2d7f9854e31cd3534071e3c730aa1 100644 (file)
@@ -565,13 +565,14 @@ bdb_db_close( BackendDB *be )
                bdb->bi_idl_lru_head = bdb->bi_idl_lru_tail = NULL;
        }
 
-       if ( !( slapMode & SLAP_TOOL_QUICK ) && bdb->bi_dbenv ) {
-               XLOCK_ID_FREE(bdb->bi_dbenv, bdb->bi_cache.c_locker);
-               bdb->bi_cache.c_locker = 0;
-       }
-
        /* close db environment */
        if( bdb->bi_dbenv ) {
+               /* Free cache locker if we enabled locking */
+               if ( !( slapMode & SLAP_TOOL_QUICK )) {
+                       XLOCK_ID_FREE(bdb->bi_dbenv, bdb->bi_cache.c_locker);
+                       bdb->bi_cache.c_locker = 0;
+               }
+
                /* force a checkpoint, but not if we were ReadOnly,
                 * and not in Quick mode since there are no transactions there.
                 */