From: Kurt Zeilenga Date: Tue, 31 Jul 2001 00:16:44 +0000 (+0000) Subject: Fix slapadd crash when only a subset of databases have been initialized. X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~1185 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ca7ba1a3fd778a5547ac0c9b59131af22ca43c78;p=openldap Fix slapadd crash when only a subset of databases have been initialized. Likely should have a general solution to this. --- diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index ac46b03a80..af3e2c3b02 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -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;