From 08792a77fddcf993ddd6eaa94a8d425dd8f68774 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 5 Aug 2014 19:36:30 -0700 Subject: [PATCH] ITS#7906 better fix don't free pwcons unless we're actually destroying this DB --- servers/slapd/overlays/ppolicy.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/servers/slapd/overlays/ppolicy.c b/servers/slapd/overlays/ppolicy.c index d6b8ac2d1a..25b14312d6 100644 --- a/servers/slapd/overlays/ppolicy.c +++ b/servers/slapd/overlays/ppolicy.c @@ -2331,7 +2331,18 @@ ppolicy_close( overlay_unregister_control( be, LDAP_CONTROL_PASSWORDPOLICYREQUEST ); #endif /* SLAP_CONFIG_DELETE */ - /* Perhaps backover should provide bi_destroy hooks... */ + free( pi->def_policy.bv_val ); + free( pi ); + + return 0; +} + +static int +ppolicy_db_destroy( + BackendDB *be, + ConfigReply *cr +) +{ ov_count--; if ( ov_count <=0 && pwcons ) { pw_conn *pwc = pwcons; @@ -2339,10 +2350,6 @@ ppolicy_close( pwc--; ch_free( pwc ); } - free( pi->def_policy.bv_val ); - free( pi ); - - return 0; } static char *extops[] = { @@ -2384,6 +2391,7 @@ int ppolicy_initialize() ppolicy.on_bi.bi_db_init = ppolicy_db_init; ppolicy.on_bi.bi_db_open = ppolicy_db_open; ppolicy.on_bi.bi_db_close = ppolicy_close; + ppolicy.on_bi.bi_db_destroy = ppolicy_db_destroy; ppolicy.on_bi.bi_op_add = ppolicy_add; ppolicy.on_bi.bi_op_bind = ppolicy_bind; -- 2.39.5