From: Pierangelo Masarati Date: Sat, 13 May 2006 02:06:10 +0000 (+0000) Subject: make sure realloc'd memory is reset X-Git-Tag: OPENLDAP_REL_ENG_2_4_1ALPHA~2^2~25 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=93b88e0bbfbbb8bb021a11a859fa7af405c4ce2d;p=openldap make sure realloc'd memory is reset --- 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;