ConfigArgs ca = { 0 };
int i, last;
- for ( last = 0; !BER_BVISNULL( &rwmap->rwm_bva_rewrite[ last ] ); last++ )
+ for ( last = 0; rwmap->rwm_bva_rewrite && !BER_BVISNULL( &rwmap->rwm_bva_rewrite[ last ] ); last++ )
/* count'em */ ;
if ( c->valx > last ) {
return 1;
}
- for ( i = c->valx; !BER_BVISNULL( &rwmap->rwm_bva_rewrite[ i ] ); i++ )
+ for ( i = c->valx; rwmap->rwm_bva_rewrite && !BER_BVISNULL( &rwmap->rwm_bva_rewrite[ i ] ); i++ )
{
ca.line = rwmap->rwm_bva_rewrite[ i ].bv_val;
ca.argc = 0;
rwmap->rwm_bva_rewrite = ch_realloc( rwmap->rwm_bva_rewrite,
( last + 2 )*sizeof( struct berval ) );
+ BER_BVZERO( &rwmap->rwm_bva_rewrite[last+1] );
for ( i = last - 1; i >= c->valx; i-- )
{
if ( rwmap->rwm_rw ) {
rewrite_info_delete( &rwmap->rwm_rw );
- ber_bvarray_free( rwmap->rwm_bva_rewrite );
+ if ( rwmap->rwm_bva_rewrite )
+ ber_bvarray_free( rwmap->rwm_bva_rewrite );
}
avl_free( rwmap->rwm_oc.remap, rwm_mapping_dst_free );