Commit 816d94b2 authored by Ondřej Kuzník's avatar Ondřej Kuzník
Browse files

ITS#9160 OOM handling in slapd

parent be61a967
......@@ -1258,7 +1258,7 @@ OpenLDAPaciNormalizeRight(
len = nattrs.bv_len + ( !BER_BVISEMPTY( &nattrs ) ? STRLENOF( "," ) : 0 )
+ ad->ad_cname.bv_len;
nattrs.bv_val = ber_memrealloc_x( nattrs.bv_val, len + 1, ctx );
nattrs.bv_val = slap_sl_realloc( nattrs.bv_val, len + 1, ctx );
ptr = &nattrs.bv_val[ nattrs.bv_len ];
if ( !BER_BVISEMPTY( &nattrs ) ) {
*ptr++ = ',';
......@@ -1270,7 +1270,7 @@ OpenLDAPaciNormalizeRight(
}
naction->bv_val = ber_memrealloc_x( naction->bv_val,
naction->bv_val = slap_sl_realloc( naction->bv_val,
naction->bv_len + STRLENOF( ";" )
+ perms.bv_len + STRLENOF( ";" )
+ nattrs.bv_len + 1,
......@@ -1345,7 +1345,7 @@ OpenLDAPaciNormalizeRights(
*nactions = nbv;
} else {
nactions->bv_val = ber_memrealloc_x( nactions->bv_val,
nactions->bv_val = slap_sl_realloc( nactions->bv_val,
nactions->bv_len + STRLENOF( "$" )
+ nbv.bv_len + 1,
ctx );
......@@ -1703,7 +1703,7 @@ OpenLDAPaciPrettyNormal(
}
bv.bv_len += STRLENOF( "/" ) + oc->soc_cname.bv_len;
bv.bv_val = ber_memalloc_x( bv.bv_len + 1, ctx );
bv.bv_val = slap_sl_malloc( bv.bv_len + 1, ctx );
ptr = bv.bv_val;
ptr = lutil_strncopy( ptr, ntype.bv_val, ntype.bv_len );
......@@ -1762,7 +1762,7 @@ OpenLDAPaciPrettyNormal(
+ ntype.bv_len + STRLENOF( "#" )
+ nsubject.bv_len;
out->bv_val = ber_memalloc_x( out->bv_len + 1, ctx );
out->bv_val = slap_sl_malloc( out->bv_len + 1, ctx );
ptr = lutil_strncopy( out->bv_val, oid.bv_val, oid.bv_len );
ptr[ 0 ] = '#';
ptr++;
......
......@@ -3032,7 +3032,7 @@ tcp_buffer_unparse( int size, int rw, Listener *l, struct berval *val )
}
}
val->bv_val = SLAP_MALLOC( val->bv_len + 1 );
val->bv_val = ch_malloc( val->bv_len + 1 );
ptr = val->bv_val;
......@@ -3110,7 +3110,7 @@ tcp_buffer_add_one( int argc, char **argv )
if ( rw & SLAP_TCP_WMEM ) slapd_tcp_wmem = size;
}
tcp_buffer = SLAP_REALLOC( tcp_buffer, sizeof( struct berval ) * ( tcp_buffer_num + 2 ) );
tcp_buffer = ch_realloc( tcp_buffer, sizeof( struct berval ) * ( tcp_buffer_num + 2 ) );
/* append */
tcp_buffer[ tcp_buffer_num ] = val;
......
......@@ -619,7 +619,7 @@ int slap_mods_check(
if( nvals && ad->ad_type->sat_equality &&
ad->ad_type->sat_equality->smr_normalize )
{
ml->sml_nvalues = ber_memalloc_x(
ml->sml_nvalues = slap_sl_malloc(
(nvals+1)*sizeof(struct berval), ctx );
for ( nvals = 0; !BER_BVISNULL( &ml->sml_values[nvals] ); nvals++ ) {
......
......@@ -3415,7 +3415,7 @@ serialNumberAndIssuerCheck(
ber_len_t src, dst;
ni.bv_len = is->bv_len - numdquotes;
ni.bv_val = ber_memalloc_x( ni.bv_len + 1, ctx );
ni.bv_val = slap_sl_malloc( ni.bv_len + 1, ctx );
for ( src = 0, dst = 0; src < is->bv_len; src++, dst++ ) {
if ( is->bv_val[src] == '"' ) {
src++;
......@@ -4004,7 +4004,7 @@ issuerAndThisUpdateCheck(
ber_len_t src, dst;
ni.bv_len = is->bv_len - numdquotes;
ni.bv_val = ber_memalloc_x( ni.bv_len + 1, ctx );
ni.bv_val = slap_sl_malloc( ni.bv_len + 1, ctx );
for ( src = 0, dst = 0; src < is->bv_len; src++, dst++ ) {
if ( is->bv_val[src] == '"' ) {
src++;
......@@ -4606,7 +4606,7 @@ serialNumberAndIssuerSerialCheck(
ber_len_t src, dst;
ni.bv_len = is->bv_len - numdquotes;
ni.bv_val = ber_memalloc_x( ni.bv_len + 1, ctx );
ni.bv_val = slap_sl_malloc( ni.bv_len + 1, ctx );
for ( src = 0, dst = 0; src < is->bv_len; src++, dst++ ) {
if ( is->bv_val[src] == '"' ) {
src++;
......
......@@ -342,9 +342,9 @@ slapmodify( int argc, char **argv )
if ( i != 0 )
{
mods.sm_values = SLAP_CALLOC( sizeof( struct berval ), i + 1 );
mods.sm_values = ch_calloc( sizeof( struct berval ), i + 1 );
if ( normalize ) {
mods.sm_nvalues = SLAP_CALLOC( sizeof( struct berval ), i + 1 );
mods.sm_nvalues = ch_calloc( sizeof( struct berval ), i + 1 );
} else {
mods.sm_nvalues = NULL;
}
......
......@@ -514,7 +514,7 @@ ordered_value_pretty(
bv = *out;
out->bv_len = idx.bv_len + bv.bv_len;
out->bv_val = ber_memalloc_x( out->bv_len + 1, ctx );
out->bv_val = slap_sl_malloc( out->bv_len + 1, ctx );
AC_MEMCPY( out->bv_val, idx.bv_val, idx.bv_len );
AC_MEMCPY( &out->bv_val[ idx.bv_len ], bv.bv_val, bv.bv_len + 1 );
......@@ -591,7 +591,7 @@ ordered_value_normalize(
bv = *normalized;
normalized->bv_len = idx.bv_len + bv.bv_len;
normalized->bv_val = ber_memalloc_x( normalized->bv_len + 1, ctx );
normalized->bv_val = slap_sl_malloc( normalized->bv_len + 1, ctx );
AC_MEMCPY( normalized->bv_val, idx.bv_val, idx.bv_len );
AC_MEMCPY( &normalized->bv_val[ idx.bv_len ], bv.bv_val, bv.bv_len + 1 );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment