]> git.sur5r.net Git - openldap/commitdiff
Fix slapadd crash when only a subset of databases have been initialized.
authorKurt Zeilenga <kurt@openldap.org>
Tue, 31 Jul 2001 00:16:44 +0000 (00:16 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 31 Jul 2001 00:16:44 +0000 (00:16 +0000)
Likely should have a general solution to this.

servers/slapd/back-bdb/init.c

index ac46b03a80453d526373a13833f8bb78407cedbc..af3e2c3b02a6c3441ca902732edf3788e26606cc 100644 (file)
@@ -252,13 +252,15 @@ bdb_db_destroy( BackendDB *be )
        struct bdb_info *bdb = (struct bdb_info *) be->be_private;
 
        /* close db environment */
-       rc = bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
-       bdb->bi_dbenv = NULL;
-       if( rc != 0 ) {
-               Debug( LDAP_DEBUG_ANY,
-                       "bdb_db_destroy: close failed: %s (%d)\n",
-                       db_strerror(rc), rc, 0 );
-               return rc;
+       if( bdb->bi_dbenv ) {
+               rc = bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
+               bdb->bi_dbenv = NULL;
+               if( rc != 0 ) {
+                       Debug( LDAP_DEBUG_ANY,
+                               "bdb_db_destroy: close failed: %s (%d)\n",
+                               db_strerror(rc), rc, 0 );
+                       return rc;
+               }
        }
 
        return 0;