mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-30 13:30:57 +08:00
make sure realloc'd memory is reset
This commit is contained in:
parent
680b98baaf
commit
93b88e0bbf
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user