From: Pierangelo Masarati Date: Sun, 29 Jul 2001 17:21:28 +0000 (+0000) Subject: fixed some memory allocation nonsense X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~1189 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6c81656a9538b09623dbddd09c753891ffa010a0;p=openldap fixed some memory allocation nonsense --- diff --git a/servers/slapd/limits.c b/servers/slapd/limits.c index 2b4829a319..ef6ccc9da6 100644 --- a/servers/slapd/limits.c +++ b/servers/slapd/limits.c @@ -23,6 +23,10 @@ get_limits( { struct slap_limits **lm; + assert( be ); + assert( timelimit ); + assert( sizelimit ); + /* * default values */ @@ -106,16 +110,15 @@ add_limits( lm->lm_timelimit = timelimit; lm->lm_sizelimit = sizelimit; - if ( be->be_limits == NULL ) { - i = 1; - be->be_limits = ( struct slap_limits ** )ch_calloc( sizeof( struct slap_limits * ), 2 ); - } 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 ) ); + i = 0; + if ( be->be_limits != NULL ) { + for ( ; be->be_limits[i]; i++ ); } + + 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+1] = NULL; return( 0 ); }