mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-03-13 14:27:59 +08:00
fixed some memory allocation nonsense
This commit is contained in:
parent
c2daca1001
commit
6c81656a95
@ -23,6 +23,10 @@ get_limits(
|
|||||||
{
|
{
|
||||||
struct slap_limits **lm;
|
struct slap_limits **lm;
|
||||||
|
|
||||||
|
assert( be );
|
||||||
|
assert( timelimit );
|
||||||
|
assert( sizelimit );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* default values
|
* default values
|
||||||
*/
|
*/
|
||||||
@ -106,16 +110,15 @@ add_limits(
|
|||||||
lm->lm_timelimit = timelimit;
|
lm->lm_timelimit = timelimit;
|
||||||
lm->lm_sizelimit = sizelimit;
|
lm->lm_sizelimit = sizelimit;
|
||||||
|
|
||||||
if ( be->be_limits == NULL ) {
|
i = 0;
|
||||||
i = 1;
|
if ( be->be_limits != NULL ) {
|
||||||
be->be_limits = ( struct slap_limits ** )ch_calloc( sizeof( struct slap_limits * ), 2 );
|
for ( ; be->be_limits[i]; i++ );
|
||||||
} else {
|
|
||||||
for ( i = 0; be->be_limits[i]; i++ );
|
|
||||||
|
|
||||||
be->be_limits = ( struct slap_limits ** )ch_realloc( be->be_limits,
|
|
||||||
sizeof( struct slap_limits * ) * ( i + 1 ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
be->be_limits = ( struct slap_limits ** )ch_realloc( be->be_limits,
|
||||||
|
sizeof( struct slap_limits * ) * ( i + 2 ) );
|
||||||
be->be_limits[i] = lm;
|
be->be_limits[i] = lm;
|
||||||
|
be->be_limits[i+1] = NULL;
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user