From 51287025368d3e0f0cac4ec7a01fe37f07b6cd5f Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Fri, 22 Jul 2005 02:08:41 +0000 Subject: [PATCH] don't crash if no underlying database was initialized --- servers/slapd/bconfig.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index 3e88c3f909..08f8b04776 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -4051,7 +4051,10 @@ config_back_db_close( BackendDB *be ) cfb_free_entries( cfb->cb_root ); cfb->cb_root = NULL; - backend_shutdown( &cfb->cb_db ); + if ( cfb->cb_db.bd_info ) { + backend_shutdown( &cfb->cb_db ); + } + return 0; } @@ -4066,13 +4069,17 @@ config_back_db_destroy( BackendDB *be ) avl_free( CfOcTree, NULL ); - cfb->cb_db.be_suffix = NULL; - cfb->cb_db.be_nsuffix = NULL; - cfb->cb_db.be_rootdn.bv_val = NULL; - cfb->cb_db.be_rootndn.bv_val = NULL; - backend_destroy_one( &cfb->cb_db, 0 ); + if ( cfb->cb_db.bd_info ) { + cfb->cb_db.be_suffix = NULL; + cfb->cb_db.be_nsuffix = NULL; + BER_BVZERO( &cfb->cb_db.be_rootdn ); + BER_BVZERO( &cfb->cb_db.be_rootndn ); + + backend_destroy_one( &cfb->cb_db, 0 ); + } free( be->be_private ); + return 0; } -- 2.39.5