]> git.sur5r.net Git - openldap/commitdiff
ITS#7906 more cleanup
authorHoward Chu <hyc@openldap.org>
Mon, 11 Aug 2014 20:48:29 +0000 (13:48 -0700)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 11 Aug 2014 21:18:00 +0000 (16:18 -0500)
db_open/close were not symmetric with init/destroy

servers/slapd/overlays/ppolicy.c

index 81371c68910548e9d8ddf70578d6a5038ff787f9..80cf0c8330beee5eeefc07c01d00e5b61c3dd909 100644 (file)
@@ -2301,6 +2301,8 @@ ppolicy_db_init(
                pwcons++;
        }
 
+       ov_count++;
+
        return 0;
 }
 
@@ -2310,7 +2312,6 @@ ppolicy_db_open(
        ConfigReply *cr
 )
 {
-       ov_count++;
        return overlay_register_control( be, LDAP_CONTROL_PASSWORDPOLICYREQUEST );
 }
 
@@ -2320,16 +2321,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;
 }
 
@@ -2339,6 +2334,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;