From: Howard Chu Date: Fri, 20 Feb 2009 00:47:04 +0000 (+0000) Subject: ITS#5960 fix rwm_bva_rewrite handling X-Git-Tag: ACLCHECK_0~801 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4d1f13b332f41827d1a779b38781c47c7878d0a9;p=openldap ITS#5960 fix rwm_bva_rewrite handling --- diff --git a/servers/slapd/overlays/rwm.c b/servers/slapd/overlays/rwm.c index f0d93ed27a..e10ee7fa13 100644 --- a/servers/slapd/overlays/rwm.c +++ b/servers/slapd/overlays/rwm.c @@ -2162,7 +2162,7 @@ rwm_cf_gen( ConfigArgs *c ) 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 ) { @@ -2218,7 +2218,7 @@ rwm_cf_gen( ConfigArgs *c ) 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; @@ -2245,6 +2245,7 @@ rwm_cf_gen( ConfigArgs *c ) 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-- ) { @@ -2369,7 +2370,8 @@ rwm_db_destroy( 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 );