From: Pierangelo Masarati Date: Tue, 2 Aug 2005 23:22:10 +0000 (+0000) Subject: address ITS#3914 X-Git-Tag: OPENLDAP_AC_BP~97 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=61f11773ba118b94fc79ba9a34fb35eb0d5be10e;p=openldap address ITS#3914 --- diff --git a/servers/slapd/compare.c b/servers/slapd/compare.c index 8787ee45c1..e7cc311f27 100644 --- a/servers/slapd/compare.c +++ b/servers/slapd/compare.c @@ -120,7 +120,7 @@ do_compare( cleanup:; op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx ); op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx ); - if ( ava.aa_value.bv_val ) { + if ( !BER_BVISNULL( &ava.aa_value ) ) { op->o_tmpfree( ava.aa_value.bv_val, op->o_tmpmemctx ); } diff --git a/servers/slapd/overlays/rwm.c b/servers/slapd/overlays/rwm.c index 20a754fa7c..0e245a367d 100644 --- a/servers/slapd/overlays/rwm.c +++ b/servers/slapd/overlays/rwm.c @@ -111,11 +111,8 @@ rwm_op_add( Operation *op, SlapReply *rs ) } if ( olddn != op->o_req_dn.bv_val ) { - ch_free( op->ora_e->e_name.bv_val ); - ch_free( op->ora_e->e_nname.bv_val ); - - ber_dupbv( &op->ora_e->e_name, &op->o_req_dn ); - ber_dupbv( &op->ora_e->e_nname, &op->o_req_ndn ); + ber_bvreplace( &op->ora_e->e_name, &op->o_req_dn ); + ber_bvreplace( &op->ora_e->e_nname, &op->o_req_ndn ); } /* Count number of attributes in entry */ @@ -325,8 +322,7 @@ rwm_op_compare( Operation *op, SlapReply *rs ) return -1; } else if ( mapped_vals[0].bv_val != op->orc_ava->aa_value.bv_val ) { - free( op->orc_ava->aa_value.bv_val ); - op->orc_ava->aa_value = mapped_vals[0]; + ber_bvreplace_x( &op->orc_ava->aa_value, &mapped_vals[0], op->o_tmpmemctx ); } mapped_at = op->orc_ava->aa_desc->ad_cname; @@ -371,7 +367,10 @@ rwm_op_compare( Operation *op, SlapReply *rs ) return -1; } - op->orc_ava->aa_value = mapped_vals[0]; + if ( mapped_vals[ 0 ].bv_val != op->orc_ava->aa_value.bv_val ) { + ber_bvreplace_x( &op->orc_ava->aa_value, &mapped_vals[0], + op->o_tmpmemctx ); + } } op->orc_ava->aa_desc = ad; } @@ -932,8 +931,7 @@ rwm_attrs( Operation *op, SlapReply *rs, Attribute** a_first, int stripEntryDN ) * the value is replaced by * ch_alloc'ed memory */ - ch_free( bv[0].bv_val ); - ber_dupbv( &bv[0], &mapped ); + ber_bvreplace( &bv[0], &mapped ); } }