From 88d575103c8ece2e06669feaf8aa9273430ceba7 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 16 Aug 2007 20:49:56 +0000 Subject: [PATCH] ITS#5094 fix from HEAD --- servers/slapd/overlays/ppolicy.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/servers/slapd/overlays/ppolicy.c b/servers/slapd/overlays/ppolicy.c index 2c68c9d0af..0046310e80 100644 --- a/servers/slapd/overlays/ppolicy.c +++ b/servers/slapd/overlays/ppolicy.c @@ -61,6 +61,7 @@ typedef struct pw_conn { static pw_conn *pwcons; static int ppolicy_cid; +static int ov_count; typedef struct pass_policy { AttributeDescription *ad; /* attribute to which the policy applies */ @@ -2118,6 +2119,7 @@ ppolicy_db_open( BackendDB *be ) { + ov_count++; return overlay_register_control( be, LDAP_CONTROL_PASSWORDPOLICYREQUEST ); } @@ -2128,8 +2130,13 @@ ppolicy_close( { slap_overinst *on = (slap_overinst *) be->bd_info; pp_info *pi = on->on_bi.bi_private; - - free( pwcons ); + + /* Perhaps backover should provide bi_destroy hooks... */ + ov_count--; + if ( ov_count <=0 && pwcons ) { + free( pwcons ); + pwcons = NULL; + } free( pi->def_policy.bv_val ); free( pi ); -- 2.47.2