From: Howard Chu Date: Thu, 16 Aug 2007 20:49:56 +0000 (+0000) Subject: ITS#5094 fix from HEAD X-Git-Tag: OPENLDAP_REL_ENG_2_3_38~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88d575103c8ece2e06669feaf8aa9273430ceba7;p=thirdparty%2Fopenldap.git ITS#5094 fix from HEAD --- 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 );