From 93b88e0bbfbbb8bb021a11a859fa7af405c4ce2d Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 13 May 2006 02:06:10 +0000 Subject: [PATCH] make sure realloc'd memory is reset --- servers/slapd/back-meta/conn.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/servers/slapd/back-meta/conn.c b/servers/slapd/back-meta/conn.c index 1158d2f00d..75f2261c9d 100644 --- a/servers/slapd/back-meta/conn.c +++ b/servers/slapd/back-meta/conn.c @@ -754,9 +754,11 @@ meta_back_candidates_get( Operation *op ) } else if ( mc->mc_ntargets < mi->mi_ntargets ) { /* NOTE: in the future, may want to allow back-config * to add/remove targets from back-meta... */ - mc->mc_ntargets = mi->mi_ntargets; mc->mc_candidates = ch_realloc( mc->mc_candidates, - sizeof( SlapReply ) * mc->mc_ntargets ); + sizeof( SlapReply ) * mi->mi_ntargets ); + memset( &mc->mc_candidates[ mc->mc_ntargets ], 0, + sizeof( SlapReply ) * ( mi->mi_ntargets - mc->mc_ntargets ) ); + mc->mc_ntargets = mi->mi_ntargets; } return mc->mc_candidates; -- 2.39.5