From 8133e7005ee49b77f4767193dd6c3a83e49a6582 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 16 Aug 2007 19:59:02 +0000 Subject: [PATCH] Fix double-free closing multiple ppolicy overlay instances --- servers/slapd/overlays/ppolicy.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/servers/slapd/overlays/ppolicy.c b/servers/slapd/overlays/ppolicy.c index 137e907649..83da96c3ee 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 */ @@ -2122,6 +2123,7 @@ ppolicy_db_open( ConfigReply *cr ) { + ov_count++; return overlay_register_control( be, LDAP_CONTROL_PASSWORDPOLICYREQUEST ); } @@ -2133,8 +2135,11 @@ 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 ) + free( pwcons ); free( pi->def_policy.bv_val ); free( pi ); -- 2.39.5