From d8e280e87c60aebb676c3a12141bfe937231089f Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 11 Aug 2014 13:48:29 -0700 Subject: [PATCH] ITS#7906 more cleanup db_open/close were not symmetric with init/destroy --- servers/slapd/overlays/ppolicy.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/servers/slapd/overlays/ppolicy.c b/servers/slapd/overlays/ppolicy.c index 820905e9b1..3fdcda9f1a 100644 --- a/servers/slapd/overlays/ppolicy.c +++ b/servers/slapd/overlays/ppolicy.c @@ -2305,6 +2305,8 @@ ppolicy_db_init( pwcons++; } + ov_count++; + return 0; } @@ -2314,7 +2316,6 @@ ppolicy_db_open( ConfigReply *cr ) { - ov_count++; return overlay_register_control( be, LDAP_CONTROL_PASSWORDPOLICYREQUEST ); } @@ -2324,16 +2325,10 @@ ppolicy_db_close( ConfigReply *cr ) { - slap_overinst *on = (slap_overinst *) be->bd_info; - pp_info *pi = on->on_bi.bi_private; - #ifdef SLAP_CONFIG_DELETE overlay_unregister_control( be, LDAP_CONTROL_PASSWORDPOLICYREQUEST ); #endif /* SLAP_CONFIG_DELETE */ - free( pi->def_policy.bv_val ); - free( pi ); - return 0; } @@ -2343,6 +2338,13 @@ ppolicy_db_destroy( ConfigReply *cr ) { + slap_overinst *on = (slap_overinst *) be->bd_info; + pp_info *pi = on->on_bi.bi_private; + + on->on_bi.bi_private = NULL; + free( pi->def_policy.bv_val ); + free( pi ); + ov_count--; if ( ov_count <=0 && pwcons ) { pw_conn *pwc = pwcons; -- 2.39.2