list because checking is performed on these, rather than the entry.
slap_mods_free() now takes an extra argument indicating whether to
free the values or not.
struct berval dn = BER_BVNULL;
ber_len_t len;
ber_tag_t tag;
- Modifications *modlist = NULL;
+ Modifications *modlist = NULL, *next;
Modifications **modtail = &modlist;
Modifications tmp;
char textbuf[ SLAP_TEXT_BUFLEN ];
slap_graduate_commit_csn( op );
if ( modlist != NULL ) {
- slap_mods_free( modlist );
+ slap_mods_free( modlist, 0 );
}
+
if ( op->ora_e != NULL ) {
entry_free( op->ora_e );
}
} else {
AC_MEMCPY( &attr->a_vals[i], mods->sml_values,
sizeof( struct berval ) * j );
- ch_free( mods->sml_values );
- mods->sml_values = NULL;
}
if( mods->sml_nvalues ) {
} else {
AC_MEMCPY( &attr->a_nvals[i], mods->sml_nvalues,
sizeof( struct berval ) * j );
- ch_free( mods->sml_nvalues );
- mods->sml_nvalues = NULL;
}
} else {
attr->a_nvals = attr->a_vals;
/* move ad to attr structure */
attr->a_desc = mods->sml_desc;
- if ( !dup ) mods->sml_desc = NULL;
/* move values to attr structure */
/* should check for duplicates */
BER_BVZERO( &attr->a_vals[i] );
} else {
attr->a_vals = mods->sml_values;
- mods->sml_values = NULL;
}
if ( mods->sml_nvalues ) {
BER_BVZERO( &attr->a_nvals[i] );
} else {
attr->a_nvals = mods->sml_nvalues;
- mods->sml_nvalues = NULL;
}
} else {
attr->a_nvals = attr->a_vals;
if ( mod->sml_nvalues ) free( mod->sml_nvalues[0].bv_val );
free( mod );
}
- slap_mods_free( mod );
+ slap_mods_free( mod, 1 );
}
/* LDAP v3 Support */
tmp = mod->sml_next;
free( mod );
}
- slap_mods_free( mod );
+ slap_mods_free( mod, 1 );
}
/* LDAP v3 Support */
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 ( op->orm_modlist != NULL ) slap_mods_free( op->orm_modlist );
+ if ( op->orm_modlist != NULL ) slap_mods_free( op->orm_modlist, 1 );
return rs->sr_err;
}
void
slap_mods_free(
- Modifications *ml )
+ Modifications *ml,
+ int freevals )
{
Modifications *next;
for ( ; ml != NULL; ml = next ) {
next = ml->sml_next;
- slap_mod_free( &ml->sml_mod, 0 );
+ if ( freevals )
+ slap_mod_free( &ml->sml_mod, 0 );
free( ml );
}
}
op->o_tag = LDAP_REQ_MODIFY;
op->orm_modlist = modlist;
op->o_bd->be_modify( op, &sreply );
- slap_mods_free( modlist );
+ slap_mods_free( modlist, 1 );
} else if ( rc == LDAP_REFERRAL ||
rc == LDAP_NO_SUCH_OBJECT ) {
syncrepl_add_glue( op, e );
op2.o_ndn = op->o_bd->be_rootndn;
op2.o_bd->bd_info = (BackendInfo *)on->on_info;
rc = op->o_bd->be_modify( &op2, &r2 );
- slap_mods_free( mod );
+ slap_mods_free( mod, 1 );
}
if ( ppb->send_ctrl ) {
for(dp = dd.mods; dp; dp = dd.mods) {
dd.mods = dp->next;
ch_free(dp->dn.bv_val);
- slap_mods_free(dp->mm);
+ slap_mods_free(dp->mm, 1);
}
dd.mods = NULL;
mm = m;
m = m->sml_next;
mm->sml_next = NULL; /* hack */
- slap_mods_free(mm);
+ slap_mods_free(mm, 1);
if(m) continue;
}
m->sml_op = LDAP_MOD_ADD;
op->o_tag = LDAP_REQ_EXTENDED;
op->o_callback = sc;
}
- slap_mods_free( qpw->rs_mods );
+ slap_mods_free( qpw->rs_mods, 1 );
if ( rsp ) {
free( qpw->rs_new.bv_val );
}
const char **text, char *textbuf, size_t textlen );
LDAP_SLAPD_F( void ) slap_mod_free( Modification *mod, int freeit );
-LDAP_SLAPD_F( void ) slap_mods_free( Modifications *mods );
+LDAP_SLAPD_F( void ) slap_mods_free( Modifications *mods, int freevals );
LDAP_SLAPD_F( void ) slap_modlist_free( LDAPModList *ml );
/*
}
}
}
- slap_mods_free( modlist );
+ slap_mods_free( modlist, 1 );
return rc != LDAP_SUCCESS ? SASL_FAIL : SASL_OK;
}
#endif /* SASL_VERSION_FULL >= 2.1.16 */
}
break;
case LDAP_REQ_ADD:
- slap_mods_free( op->ora_modlist );
+ slap_mods_free( op->ora_modlist, 1 );
break;
case LDAP_REQ_MODIFY:
- slap_mods_free( op->orm_modlist );
+ slap_mods_free( op->orm_modlist, 1 );
break;
case LDAP_REQ_SEARCH:
if ( op->ors_attrs != NULL ) {
}
if ( entry_orig != NULL ) {
pb->pb_op->ora_e = entry_orig;
- slap_mods_free( pb->pb_op->ora_modlist );
+ slap_mods_free( pb->pb_op->ora_modlist, 1 );
pb->pb_op->ora_modlist = NULL;
}
mods[i] = NULL;
- slap_mods_free( modlist );
+ slap_mods_free( modlist, 1 );
*pmodlist = NULL;
return mods;
}
ldap_controls_free( rctrls );
if ( modlist ) {
- slap_mods_free( modlist );
+ slap_mods_free( modlist, 1 );
}
if ( rc_efree && entry ) {
entry_free( entry );