From 8cd909db3fba1ee23d1dc241f7de0b006bcfb7aa Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 17 Aug 2009 14:38:28 +0000 Subject: [PATCH] Plug leaks in prev commit --- servers/slapd/overlays/pcache.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/servers/slapd/overlays/pcache.c b/servers/slapd/overlays/pcache.c index 70d2b97a14..bcaf7ac1b7 100644 --- a/servers/slapd/overlays/pcache.c +++ b/servers/slapd/overlays/pcache.c @@ -2718,7 +2718,7 @@ refresh_merge( Operation *op, SlapReply *rs ) /* Entry exists, update it */ Entry ne; Attribute *a, **b; - Modifications *modlist, *mods; + Modifications *modlist, *mods = NULL; const char* text = NULL; char textbuf[SLAP_TEXT_BUFLEN]; size_t textlen = sizeof(textbuf); @@ -2731,6 +2731,9 @@ refresh_merge( Operation *op, SlapReply *rs ) if ( ad_inlist( a->a_desc, rs->sr_attrs )) { *b = attr_alloc( a->a_desc ); *(*b) = *a; + /* The actual values still belong to e */ + (*b)->a_flags |= SLAP_ATTR_DONT_FREE_VALS | + SLAP_ATTR_DONT_FREE_DATA; b = &((*b)->a_next); } } @@ -2739,6 +2742,8 @@ refresh_merge( Operation *op, SlapReply *rs ) syncrepl_diff_entry( op, ne.e_attrs, rs->sr_entry->e_attrs, &mods, &modlist, 0 ); be_entry_release_r( op, e ); + attrs_free( ne.e_attrs ); + slap_mods_free( modlist, 1 ); /* mods is NULL if there are no changes */ if ( mods ) { struct berval dn = op->o_req_dn;